This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 23 days ago.
Non-zero exit code (1):
_pydevd_bundle/pydevd_cython.c:13:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Please help me resolve this error of trying to install Cython in PyCharm.
JetBrains has provided an answer:
https://www.jetbrains.com/help/pycharm/2017.3/cython-speedups.html
If you're on Ubuntu, run:
For Python 2.7: sudo apt-get install python-dev
For Python 3.5: sudo apt-get install python3-dev
For Python 3.6: sudo apt-get install python3.6-dev
For Python 3.7: sudo apt-get install python3.7-dev
For python 3.7 sudo apt install libpython3.7-dev
solved my problem
Works also for Python 3.9
sudo apt-get install python3.9-dev
Every time PyCharm makes an IDE update, I spend endless hours searching for how to do it again in Linux.
I'd like to register my answer here for my own self next time.
You have to use the system python.
Before anything, you have to have sudo apt-get install python<your_bin_version>-dev
Obs. Use which python at usr/bin to find out.
However, the system python does not recognize conda setuptools.
Thus, you also need sudo apt-get install python3-setuptools
After that, if you run, the updated place of PyCharm help, as such:
sudo /usr/bin/python3 /<your_pycharm_installation_dir>/pycharm-2021.1/plugins/python/helpers/pydev/setup_cython.py build_ext --inplace
Then, and only then, it works ... (but only for the base python).
Next, I found the recently constructed directory /_pydevd_bundle and manually (yeah) copied it into
/<your conda environmenbt>/.conda/envs/py39web/compiler_compat
Except for jupyter notebooks, though.
Related
This question already has answers here:
mysql_config not found when installing mysqldb python interface
(36 answers)
Closed 2 years ago.
I am trying to install mysqlclient for python, but I always get this error when I try:
$ pip3 install mysqlclient
How can I resolve this issue?
Looking at the error message, it seems that there is an OS Error, and judging by the terminal layout, you're using Linux.
It seems that to install this package on Linux, there are extra instructions to follow, mentioned on the module's github page:
You may need to install the Python 3 and MySQL development headers and
libraries like so:
$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu
% sudo yum install python3-devel mysql-devel # Red Hat / CentOS
Then you can install mysqlclient via pip now:
$ pip install mysqlclient
This question already has answers here:
Unable to install pip in ubuntu?
(2 answers)
Closed 1 year ago.
I am trying to install virtualenv on Ubuntu.
First it said command 'pip' not found, so I typed
sudo apt install python-pip
then it said
E: Unable to locate package python-pip
I tried to reset WSL, download using cmd but it doesn't work with Ubuntu. I don't know why. Even though I have downloaded python3, virtualenv, and pip using cmd. It doesn't work with Ubuntu 18.04. It also fails on Ubuntu 14.04.
aiki#LAPTOP-886AEJJG:~$ pip
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
aiki#LAPTOP-886AEJJG:~$ sudo apt install python-pip
[sudo] password for aiki:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
I'm trying to install jarvis and mycroft on win 10, but I need to use Ubuntu because it only works with Linux.
ls /bin/python*
Identify the highest version of python listed.
If the highest version is something like python2.7 then install python2-pip
If its something like python3.8 then install python3-pip
Example for python3.8:
sudo apt-get install python3-pip
Try following command sequence on Ubuntu terminal:
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python3-pip
Try the following commands in terminal, this will work better:
apt-get install curl
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
On some kind of Linux, like distros based on Debian, you might want to consider updating your 'apt-get' first, in case you are installing python-pip through it.
sudo apt-get update
This might help apt-get to update its indexes and locate the python-pip package.
After this, u might install it like this-
sudo apt-get install python-pip (Python2)
sudo apt-get install python3-pip (Python3)
You might have python 3 pip installed already. Instead of pip install you can use pip3 install.
To solve the problem of:
E: Unable to locate package python-pip
you should do this. This works with the python2.7 and you not going to get disappointed by it.
follow the steps that are mention below.
go to get-pip.py and copy all the code from it.
open the terminal using CTRL + ALT +T
vi get-pip.py
paste the copied code here and then exit from the vi editor by pressing
ESC then :wq => press Enter
lastly, now run the code and see the magic
sudo python get-pip.py
It automatically adds the pip command in your Linux.
you can see the output of my machine
I'm using WSL2 on Windows 10 and I had the same issue. Try the way which helped me to fix this. I assume that you are using python3.
python3 get-pip.py
sudo apt install python3-pip
On Ubuntu 14.04, I use Pycharm Professional Edition. When I start a debug session, I see the following message in the event log of Pycharm:
Python Debugger Extension Available
Cython extension speeds up Python debugging
Install How does it work
Clicking on Install leads to a popup window with an error message:
I depict here the text, too, so that it can be found by others more easily:
Compile Cython Extensions Error
Non-zero exit code (1):
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
To look for a solution:
I compiled Cython speedups manually according to the link mentioned above: /usr/bin/python3 /<PYCHARM_INSTALLATION_PATH>/helpers/pydev/setup_cython.py build_ext --inplace. This finishes successfully, but does not help with the error message.
I added the python-3.6-dev repository:
sudo add-apt-repository ppa:deadsnakes/ppa, executed: sudo apt-get update && sudo apt-get dist-upgrade
and installed python-3.6-dev: sudo apt-get install python3.6-dev
It finishes successfully, but does not change the above popup error message.
What else can I check or execute?
EDIT
regarding the installation of gcc, it looks like the following:
user#user-computer:~$ gcc
The program 'gcc' is currently not installed. You can install it by typing:
sudo apt-get install gcc
user#user-computer:~$ sudo apt-get install gcc
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version.
The following packages were automatically installed and are no longer required:
libseccomp2 libwireshark5 libwiretap4 libwsutil4
linux-image-3.13.0-160-generic linux-image-extra-3.13.0-160-generic
linux-lts-xenial-tools-4.4.0-137 linux-signed-image-4.4.0-137-generic
linux-tools-4.4.0-137-generic squashfs-tools
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
user#user-computer:~$ gcc
The program 'gcc' is currently not installed. You can install it by typing:
sudo apt-get install gcc
At first:
sudo apt install --reinstall gcc
Then run commands below depends on version of Python , you are using:
For Python 2.x use:
$ sudo apt-get install python-dev
For Python 3.x use:
$ sudo apt-get install python3-dev
For Python 3.8 use:
$ sudo apt-get install python3.8-dev
For future reference:
Cython uses gcc (by default), need to verify it is installed and working properly.
As it installed by default on most recent Ubuntu distributions, if it is not working well, you can follow OP fix and use sudo apt install --reinstall gcc
Hello i'm trying to run an odoo project and everytime i try to run it i get the following error
ImportError: No module named 'psutil'
i have tried to run
import psutil
via command line and it gives me also this error
i'm using odoo 11 and python 3.5
i have tried the following commands to install the package
sudo apt-get install python3-dev
also
sudo apt-get install python3-psutil
and for sure
sudo pip3 install psutil
and it supposed to be installed now as when i run the last command again it gives me this message
Requirement already satisfied: psutil in /usr/local/lib/python3.5/dist-packages (5.4.5)
but when i run the odoo project it gives me the error
thanks
I don't know if this is the same problem (I am working on a vanilla Ubuntu 16.04), but I was getting a similar frustrating message around psutil. The problem seemed to be that it was installed in my Python 2.7 version, and pip was only looking at that version, seemingly ignoring the fact that my current virtual environment was Python 3.5.
I noticed pip3 did nothing, so I installed pip3 with apt-get install python3-pip. Then I could could successfully use pip3 install psutil to install into the correct Python3.5 and my virtual directory.
What I am puzzled by is how I got so far without hitting this earlier. I have installed lots of things over the last few months with pip and they seemingly went into both versions (side-by-side Python2.7 and Python3.5 environments for running TensorFlow). Why is it different for psutil?
But it works now.
Perhaps these steps might fix your problem.
Change the Python3 default version in Ubuntu
From the comment:
sudo update-alternatives --config python
Will show you an error:
update-alternatives: error: no alternatives for python3
You need to update your update-alternatives, then you will be able to set your default python version.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
Then run :
sudo update-alternatives --config python
Set python3.6 as default.
Or use the following command to set python3.6 as default:
sudo update-alternatives --set python /usr/bin/python3.6
use ubuntu virtualenv. I try to install reportlab
the command is
pip install reportlab
in this directory
(company2)stefano#stefano-X550EP:~/htdocs/company2$
the error is
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
actually the pip list is:
argparse (1.2.1)
Django (1.7.7)
html5lib (0.999)
pip (1.5.4)
pisa (3.0.33)
PyPDF2 (1.24)
setuptools (2.2)
wsgiref (0.1.2)
xhtml2pdf (0.0.6)
I need reportlab to use xhtml2pdf because now the django project gives me this error:
No module named reportlab.lib.colors
without your full error log, it is impossible to tell. But I bet you are just missing python-dev.
try installing it:
$ sudo apt-get install python-dev
then pip install reportlab again.
hope that helps.
see: installing Reportlab (error: command 'gcc' failed with exit status 1 )
The sudo apt-get install python-dev is almost correct. But if you are using Python 3.x you need to change it to install python3-dev. This made all the difference in my django, postgresql, venv setup.
I was also having the same issue while installing readability-lxml a python package. Then I tried installing following packages, and it worked for me.
sudo apt install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev
It majorly depends on the type of packages you suppose to install. Frequently its failing due to the missing of libsasl2-dev a package for authentication abstraction library which uses in the Ubuntu version
First, install:
sudo apt-get install libsasl2-dev
then run:
sudo pip install sasl
I know I am late. But after searching all over this is what solved mine. It need c++ compiler for reportlab. Try Installing g++, the c++ compiler
sudo apt install g++