At first, I was trying to install evo (a package for SLAM research) from source and I encountered an error:
ModuleNotFoundError: No module named 'numpy'
So then I tried to install numpy using pip install numpy. However I encountered another error:
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
Finally, I tried to install python-dev using sudo apt-get install python-dev, and I found out it has been installed already. So I don't know where the problem is.
My default python version is 3.8.16
Could anyone help me with this issue?
maybe conda could install it?
conda install -c anaconda numpy
it isn't generally ideal to mix conda and pip, but it should still install numpy successfully.
Run pip3 install --upgrade pip and try again.
If it doesn't work, try sudo apt-get install pypy-dev instead of python-dev.
You can also try sudo apt-get install python3-numpy
Related
I have import psycopg2 in my code yet I keep getting ImportError: No module named psycopg2when I try to run it. I've tried
└─$ pip3 install psycopg2
└─$ pip install psycopg2-binary
└─$ sudo apt-get install build-dep python-psycopg2
anyone have a solution to this?
The issue here is: Which Python version do you want to have psycopg2? I am posting 2 solutions, since I'm not sure which one is helpful in your case:
If you want to install it for Python 2, python -m pip install psycopg2 should do this.
If you want to install the package for Python 3, you can run python3 -m pip or pip3. This should avoid confusions with Python 2 installations.
pip used to work fine until recently. First I was trying to install a pip-package using
pip install -e [some-git-link]
and I get the error
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/home/me/.local/lib/python2.7/site-packages/pip-19.0.1.dist-info/METADATA'
I then cd'ed into site-packages and the folder is empty. Indeed, I have pip installed in dis-packages and its version is 18.1, not 19.0!
I tried to update pip through
pip install -U pip
but I get the same error.
Typing
pip --version
I get
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
so it seems that pip 18.1 is installed. Indeed, if I try
sudo apt-get install python-pip
I get
python-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 62 not upgraded.
I was wondering if all these problems were coming from the warning on the cryptography, and so I tried to do
sudo pip install --upgrade cryptography
but obviously I go back to the same Environment Error.
Thou shalt not use sudo with pip. Using sudo with pip is asking for trouble. When you do that you are having pip and your OS's package manager get into a fight. When they fight no one wins, least of all your Python installation and personal sanity. I know countless tutorials tell you to sudo pip install, but they are not your friends. The only safe and reliable way to maintain a functional Python installation is to let your OS's package manager manage what it wants to manage and either use pip install --user or virtual environments (using either virtualenv or optionally python -m venv if you're on Python 3).
I really can't stress enough that you will constantly be running into little weird things (and occasional catastrophic problems) within your Python installation if you persistently sudo install things. Learn to love virtual environments! You can even modify your shell's PATH so that things you install in an environment are available as commands (which is commonly why people think they need sudo pip install).
You could test to update PythonOpenSSL :
$ sudo python -m easy_install --upgrade pyOpenSSL
If not Ok, please do :
$ sudo pip install --upgrade cryptography
But error with : $ sudo pip
So do after :
$ sudo python -m easy_install --upgrade pyOpenSSL
Have Fun,
Johan MRe
I was getting this error trying to install packages while building a Docker image (with python:3.8 as base). Upgrading pyOpenSSL as #Johan MRe suggested solved it for me.
RUN python3 -m easy_install --upgrade pyOpenSSL
How to deal with "Could not install packages due to an EnvironmentError" when upgrade pip
First run command line in Administration mode both window and OS:
Next,
For windows: use this command to upgrade pip
python -m pip install --user --upgrade pip
For MacOS:
sudo python -m pip install --user --upgrade pip
I am trying to install paho-mqtt package for my python project. But it gives the error
Error: Python packaging tool 'pip' not found.
I am using ubuntu 16.04 and I am running this command
pip install paho-mqtt
Can anyone tell me is there another way to install this?
Install pip first, if using python2
sudo apt-get install python-pip
or for python3
sudo apt-get install python3-pip
Python uses pip to install various Python modules like request, jsonpickel etc.
So you need to install pip first as said by #Asoul
I'm trying to install h5py, but when I do pip install h5py or use python setup.py install from the source code, fatal error:
hdf5.h: No such file or directory.
Other posts mention to do pip install libhdf5-dev or pip install libhdf5-serial-dev to resolve this, but it says "no matching distribution found."
How can I install h5py? I am ssh'd into an Odyssey computer using the CentOS 6.5 version of the Linux. Also, I do not have sudo privileges. Thanks!
Your error is because you are missing the hdf5.h header, pip will not install the development headers, you need to install them using your package manager, on Centos it would be:
yum install hdf5-devel
If you look at the installation instrcutions:
Source installation on Linux and OS X
You need, via apt-get, yum or Homebrew:
Python 2.6, 2.7, 3.3, or 3.4 with development headers (python-dev or similar)
HDF5 1.8.4 or newer, shared library version with development headers (libhdf5-dev or similar)
NumPy 1.6.1 or later
This link helped:
https://github.com/Homebrew/legacy-homebrew/issues/23144
I installed LinuxHomeBrew and did:
brew tap homebrew/science
brew install hdf5
pip install h5py
I was able to install h5py!
sudo apt-get update
sudo apt-get install python-h5py
(Source)
Also, not pip install libhdf5-dev or pip install libhdf5-serial-dev, but apt install libhdf5-dev and apt install libhdf5-serial-dev.
Then, run pip install h5py
Running the below fixed my problem as I had an error related to xlocale.h
sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
I am running OS X El Capitan v. 10.11.3
I am trying to install PyAutoGUI
On Terminal, I did the following successfully:
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc
When I tried running "sudo pip3 install pyautogui" I got the following error in Terminal:
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-build-skuvquyu/pyscreeze
I am not sure what to do about this so if anyone has any advice, I would appreciate it.
Thanks
Found an answer to the problem
On Linux, this is:
sudo pip3 install python3-xlib
sudo apt-get install scrot
sudo apt-get install python3-tk
sudo apt-get install python3-dev
sudo pip3 install pyautogui
ta daaaa :D
It seems like there's a problem with pip. Try reinstalling it.
It'd be much better if you installed pyautogui directly from github.
Step 1:
git clone https://github.com/asweigart/pyautogui
Step 2:
cd pyautogui
Step 3:
sudo python3 setup.py install
If python3 doesn't work, try python.
Now im using Ubuntu 14.04, but I would try installing the problematic module pyscreeze with:
sudo pip3 install pyscreeze
I personally got another error about missing module called PIL
sudo pip3 install pillow
And then i got some error message about jpeg ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
I hope you'll have more luck.
This installation error has most likely been fixed as of version 0.9.34. The module tried to load the PIL/Pillow module during installation.
i have installed pyautogui on my windows :
I went to my python directory
There shift + right mouse click and open the command prompt
Type "python -m pip install pyautogui" (without quotes)