Python 3.10 is released and when I try to install NumPy it gives me this: NumPy 1.21.2 may not yet support Python 3.10.. what should I do?
If on Windows, numpy has not yet released a precompiled wheel for Python 3.10. However you can try the unofficial wheels available at https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy .
Specifically look for
numpy‑1.21.2+mkl‑cp310‑cp310‑win_amd64.whl or
numpy‑1.21.2+mkl‑cp310‑cp310‑win32.whl
depending on you system architecture.
After downloading the file go to the download directory and run pip install "<filename>.whl".)
(I have personally installed numpy‑1.21.2+mkl‑cp310‑cp310‑win_amd64.whl and it worked for me.)
Since you are on MS-Windows you can also make use of pipwin - this windows only utility is pip installable and can download and install a number of "unofficial" builds (provided by the excellent Christoph Gohlke) of scientific from the https://www.lfd.uci.edu/~gohlke/pythonlibs/ but takes the guesswork out of which file(s) to download and install.
A session might run:
pip install pipwin
pipwin install numpy
Alternatively you could use the py launcher as in:
py -3.10 -mpip install pipwin
py -3.10 -mpipwin refresh
py -3.10 -mpipwin install numpy
The middle step tells pipwin to populate its list of what is currently available.
If you don't mind using Docker and Debian, the official python:3.10 (==python:3.10-bullseye) docker container has pip pre-installed. And some packages like numpy can be installed using pip install and run under python 3.10 (good luck with other packages though:).
Here's some PoC and proof that numpy really works there:
$ docker run -it --rm --name python310 -u 0 python:3.10 bash -c 'pip --version; pip install numpy --user --no-cache; pip show numpy; python -c "import numpy as np; print(np.ones(5))"'
..which should output:
pip 21.2.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Collecting numpy
Downloading numpy-1.21.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB)
|████████████████████████████████| 15.9 MB 36.9 MB/s
Installing collected packages: numpy
WARNING: The scripts f2py, f2py3 and f2py3.10 are installed in '/root/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.21.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Name: numpy
Version: 1.21.4
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
License: BSD
Location: /root/.local/lib/python3.10/site-packages
Requires:
Required-by:
[1. 1. 1. 1. 1.]
I use Ubuntu and I had the same issue but when changed the version from 1.19.5 to 1.22.1 my issue fixed
Related
I am using pip in Ubuntu 20.04 with Python 3.8. I am trying to upgrade some packages and it seems to work since it does not give any error message. However, if I do pip show for the desired package, the version remains unchanged.
For instance, in the case of pip itself I am doing the following:
python -m pip install --upgrade pip
And I am obtaining:
Collecting pip
Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Successfully installed pip-20.3.3
Then, when I try to check the installed version with pip show pip, I get the following:
Name: pip
Version: 20.0.2
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: pypa-dev#groups.google.com
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:
Required-by: pip-upgrade
I have observed this problem also for scipy. However, I have been able to upgrade virtualenv and seaborn following the same procedure described above.
On the other hand, if I do the same upgrade process using sudo it does work. However, I would like to have the new versions installed not only for superuser.
Thanks in advance.
You may have multiple installations of Python on your system.
First provide the full name for Python 3.8 when installing pip to make sure it is installing pip for 3.8.
python3.8 -m pip install --upgrade pip
You could also try to use the pip specifically for Python 3.8. It is usually called pip3.8.
It could also be the environment you are installing it in. It's better to use pip --version so that you know where it is pulling pip from, as well the version of Python being used.
pip3.8 --version
pip 20.3.3 from /home/eandersson/.local/lib/python3.8/site-packages/pip (python 3.8)
As you can see here depending on the user and env variables set it may be installed in a different location.
sudo pip3.8 --version
pip 20.2.3 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
I would also recommend that you use a virtualenv if you need specific versions libraries installed for your project.
virtualenv venv
source venv/bin/activate
pip install pip --upgrade
I like to use pip to download the source of Python packages, without installing them. To download e.g. SciPy 1.4.1 I would use
python3 -m pip download --no-binary=:all: scipy==1.4.1
This generally works, but for at least SciPy 1.4.1 and pip 20.0, 20.0.1 and 20.0.2 it does not.
The SciPy source is in fact downloaded, but due to an error in the "Installing build dependencies" step, the SciPy source is being cleaned up. (I don't really want this build step, but even supplying --no-deps doesn't get rid of it. It doesn't actually install anything though.)
What's changed with pip, and (more importantly) how do I fix it?
It works if I add the --no-use-pep517 option:
python3 -m pip download --no-binary=:all: --no-use-pep517 scipy==1.4.1
This also could be fixed with
pip install -U virtualenv pip
virtualenv .venv --seeder pip
source .venv/bin/activate
python3 -m pip download --no-binary=:all: scipy==1.4.1
I am trying to install the OpenCV-python on my mac and i have used the following:
$pip install opencv-python
which gave me the following error:
$pip install opencv-python
Collecting opencv-python
Using cached opencv_python-3.4.0.12-cp27-cp27m macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.11.1 (from opencv-python)
Using cached numpy-1.14.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: numpy, opencv-python
Found existing installation: numpy 1.8.0rc1
Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Then i did try the pip install --upgrade matplotlib which didnot change anything. It just show me:
matplotlib 2.2.2 requires backports.functools-lru-cache, which is not installed.
matplotlib 2.2.2 has requirement numpy>=1.7.1, but you'll have numpy 1.8.0rc1 which is incompatible.
As I found many ways to install the openCV-python in the internet like:
https://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/
and I installed on my other mac but i got import cv2 problem alot in my codes.
I will be more than happy if anyone have a good solution or recommendation to install the openCV-python.
Thanks
In summary, macOS comes with the Python preinstalled and you should not mess with the packages installed as some system utilities depend on them.
https://docs.python.org/3.7/using/mac.html
The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.
You should take a look on either venv or virtualenv.
You can read this answer: https://stackoverflow.com/a/41972262/4796844 that will get you through the basics.
In a nutshell, to solve your problem:
$ python3 -m venv ./project-name
$ . ./project-name/bin/activate
$ pip install opencv-python
And to leave the virtual environment, simply:
$ deactivate
I commit a silly mistake and installed the wrong version of Tensorflow (I'm using windows but installed the mac version). How do I uninstall the wrong version?
Also I found out that Tensorflow can only be installed in the Python 3.5 version(mine is 3.6), is that true? How to downgrade my Python without losing all libraries?
Name: tensorflow
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource#google.com
License: Apache 2.0
Location: c:\users\eleut\appdata\local\programs\python\python36-32\lib\site-packages
Requires: protobuf, wheel, numpy, six
To uninstall tensorflow just use this command:
pip3 uninstall tensorflow
TensorFlow with Python3.6
It should work because ticket https://github.com/tensorflow/tensorflow/issues/6533
is closed. You just need to install tensorflow once again and it should work under python3.6:
pip3 install tensorflow
If not use the following instructions:
"Downgrade" to python3.5
You can't just change python version, because some libraries can be incompatible with python3.5.
You should save current libraries versions in file using this command:
pip3 freeze > ./requirements.txt
Python3.5 installation
If you have only python3.6 and want to install python3.5 easily you can use pyenv (https://github.com/pyenv/pyenv) and create virtualenv with python3.5 using instructions from pyenv tutorial.
Installing libraries from python3.6
Make sure that your virtualenv with python3.5 is activated. You should have name of this virtualenv visible in bash prompt. Make sure that your python version is 3.5 using this command:
python --version
After that you can install libraries from your python3.6 using this command:
pip3 install -r <path to requirements.txt file>
If installation fails:
If installation fails for some packages, just edit requirements.txt by removing version from this file. For example if version 2.0 of some_package does't work under python3.5 then change line from requirements.txt:
some_package==2.0
to:
some_package
save changes and run once again
pip3 install -r <path to requirements.txt file>
Just use: pip3 uninstall tensorflow
I have tried installing matplotlib different ways.
I have tried
$ pip install matplotlib
and
$ easy_install matplotlib
But whenever I run my python program, I get the following error.
ImportError: No module named matplotlib
What is the best way to install python modules?
try to upgrade pip as suggested:
python -m pip install --upgrade pip
Also did you installed all the dependencies:
"For standard Python installations you will also need to install compatible versions of setuptools, numpy, python-dateutil, pytz, pyparsing, and cycler in addition to matplotlib."
Simply download IPython with the Anaconda Suite....
https://www.continuum.io/downloads
It brings most of the needed modules (as this is a crappy task if you have to download stuff to site-packages and run python setup.py install 3781 times..)
Moreover it sports module package manager (comparable to Synaptic on Ubuntu..) if you are to lazy for the above mentioned task (and you are..).
Greets Dr. Cobra
conda install matplotlib
conda install -c conda-forge matplotlib
pip install matplotlib