# Ubuntu error Django part3 : Running Backgroud task lecture#5

**URL:** <https://forum.codewithmosh.com/t/ubuntu-error-django-part3-running-backgroud-task-lecture-5/22000>\
**Category:** Django\
**Created:** [August 13, 2023, 4:48am UTC](https://forum.codewithmosh.com/t/ubuntu-error-django-part3-running-backgroud-task-lecture-5/22000 "2023-08-13T04:48:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohid](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Mohid](https://forum.codewithmosh.com/u/Mohid)\
**Post date:** [August 13, 2023, 4:48am UTC](https://forum.codewithmosh.com/t/ubuntu-error-django-part3-running-backgroud-task-lecture-5/22000/1 "2023-08-13T04:48:37Z")

</div>

pip install mysqlclient Installation error in ubuntu. After following the steps in the pdf file **Running Django on WSL** when I enter

**pip install mysqlclient**  
I get this error:  
Defaulting to user installation because normal site-packages is not writeable  
Collecting mysqlclient  
Using cached mysqlclient-2.2.0.tar.gz (89 kB)  
Installing build dependencies … done  
Getting requirements to build wheel … error  
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.  
│ exit code: 1  
╰─\> [27 lines of output]  
/bin/sh: 1: pkg-config: not found  
/bin/sh: 1: pkg-config: not found  
Trying pkg-config --exists mysqlclient  
Command ‘pkg-config --exists mysqlclient’ returned non-zero exit status 127.  
Trying pkg-config --exists mariadb  
Command ‘pkg-config --exists mariadb’ returned non-zero exit status 127.  
Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/pip/\_vendor/pep517/in\_process/\_in\_process.py”, line 363, in   
main()  
File “/usr/lib/python3/dist-packages/pip/\_vendor/pep517/in\_process/\_in\_process.py”, line 345, in main  
json\_out[‘return\_val’] = hook(\*\*hook\_input[‘kwargs’])  
File “/usr/lib/python3/dist-packages/pip/\_vendor/pep517/in\_process/\_in\_process.py”, line 130, in get\_requires\_for\_build\_wheel  
return hook(config\_settings)  
File “/usr/lib/python3/dist-packages/setuptools/build\_meta.py”, line 162, in get\_requires\_for\_build\_wheel  
return self.\_get\_build\_requires(  
File “/usr/lib/python3/dist-packages/setuptools/build\_meta.py”, line 143, in \_get\_build\_requires  
self.run\_setup()  
File “/usr/lib/python3/dist-packages/setuptools/build\_meta.py”, line 158, in run\_setup  
exec(compile(code, **file** , ‘exec’), locals())  
File “setup.py”, line 154, in   
ext\_options = get\_config\_posix(get\_options())  
File “setup.py”, line 48, in get\_config\_posix  
pkg\_name = find\_package\_name()  
File “setup.py”, line 27, in find\_package\_name  
raise Exception(  
Exception: Can not find valid pkg-config name.  
Specify MYSQLCLIENT\_CFLAGS and MYSQLCLIENT\_LDFLAGS env vars manually  
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.  
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.  
│ exit code: 1  
╰─\> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

---

<div class="post-metadata">

**Author:** ![Jhay](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@Jhay](https://forum.codewithmosh.com/u/Jhay)\
**Post date:** [October 28, 2023, 4:48pm UTC](https://forum.codewithmosh.com/t/ubuntu-error-django-part3-running-backgroud-task-lecture-5/22000/2 "2023-10-28T16:48:40Z")

</div>

I got the same error messages too when I ran the code. I did some searches online (Stack Overflow) and I was able to resolve them by running the below steps.  
To fix, run  
i. sudo apt-get install python3-dev default-libmysqlclient-dev build-essential  
ii. pip install mysqlclient  
iii. The first two steps should work. If it doesn’t, run sudo apt install pkg-config This should fix it.
