Pip install Numpy Errors - python

I tried to upgrade pandas from 19.2 to 20.2
I did pip -install --upgrade pandas
and it ran successfully. However, now when I try to import pandas I get:
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
I uninstall and re-install numpy with pip uninstall numpy and pip install numpy. But it seems like numpy is using a cashed version. I did install numpy MKL a while back....:
C:\Windows\System32>pip install numpy
Collecting numpy
Using cached numpy-1.13.0-cp36-none-win32.whl
Installing collected packages: numpy
Successfully installed numpy-1.13.0
How do i install the "normal" version of numpy? As I believe this cached version is causing the issues

Go to this link and download the relevant numpy .whl file:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Then navigate to the directory from which it is downloaded to and run the pip install command for that file.
Hope this helps!

Do you use anaconda ? Try to run this script in cmd :
"conda install numpy"
Another solution might be to delete .pyc file your python project created. Python interpreter compiles source to byte code, which is stored in .pyc and byte code is afterwars executed by Pythons virtual machine.

Related

Python, pip install stuck on collecting "module_name"

Using freshly installed python 3.5.2 on windows 10, trying to install libraries via cmd, gives such result:
C:\Python35>pip install theano
Collecting theano
C:\Python35>pip install numpy
Collecting numpy
C:\Python35>pip list
pip (8.1.1)
setuptools (20.10.1)
C:\Python35>
The question is simple, how to make pip to install?
About trial and error. I did try to find solution, yes, and here is what does not work:
Using --no-cache-dir
pip install numpy-1.16.1-cp37-cp37m-win_amd64.whl same for Theano
python -m pip install and every special combination of parameters like pip3 -vvv and so on.
manually deleted the contents of the cache directory
ran as administrator, launched cmd from python folder
reinstalled python, restarted pc, have internet connection

"ERROR: Failed building wheel for numpy" during pip install opencv-python on python 3.10 [duplicate]

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

Opencv not installing for python in terminal

I am trying to install opencv in the terminal but every time I try installing it an error comes up saying ERROR: Failed building wheel for numpy Failed to build numpy ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
I tried installing with pip install opencv-python and pip install opencv-contrib-python
Opencv apparently doesn't work well with M1 chip macs, so I advise using conda instead of venv or pip, things that showed errors with pip doesn't show in conda. For me atleast :)

Pip fails to install SciPy

I have been trying to install SciPy through pip with pip install scipy but it gives me the error Failed building wheel for scipy, promptly followed by Failed cleaning build dir for scipy.
I have tried upgrading pip through pip install --upgrade pip as suggested here, installing it through anaconda as suggested here as well as the solutions suggested by pip. Those solutions being:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
And:
- `pip install .` (from a git repo or downloaded source
release)
- `pip install scipy` (last SciPy release on PyPI)
When I try to upgrade pip it gives:
Requirement already up-to-date: pip in c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages
When I try to install it through anaconda Windows gives: The program has stopped responding.
All help is appreciated and please feel free to leave a comment telling me is there is more information needed to help solve this issue. I am using Windows 10 as well as Python 3.6.2.
Thanks to jpmc26 in the comments for the solution:
You need to install the unofficial binary from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
To install it, execute: pip install C://Users/YOUR_USERNAME/Downloads/SCIPY_FILE
Make sure you use the correct version for your system (32 bit vs 64 bit) and for your Python version
You also need to look into site-packages and see if there's garbage there. If there is, delete it.
I've run into that issue before, and my resolution was to install needed dependencies. I seem to recall scipy requires numpy to be installed first. Perhaps try pip install numpy first?
The SciPy install page shows this:
pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
I struggled as well trying to create a backwards compatible environment for some older tutorial scripts. I needed Scipy==0.18.2. So I searched on Anaconda and found:
conda install -c esri scipy
This worked without a hitch.
the best way to download the package via the following link:
https://pypi.org/project/scipy/#files
install this file through pip install: you can see
install downloaded package

Install Numpy 1.9.2 on Ubuntu from Terminal

I have Python 2.7 version and I am trying to upgrade or fresh install numpy 1.9.2 version. I am trying the upgrade option.
command:
pip install numpy --upgrade
message:
Requirement already up-to-date: numpy in /usr/local/lib/python2.7/dist-packages
Cleaning up...
But still it has same old 1.8 version
Any other alternative to upgrade the numpy version ?
If the pip is not working simply install numpy manually. First clone the git repo
git clone git://github.com/numpy/numpy.git numpy
Then enter its directory and just install the lib
cd numpy
sudo python setup.py
#edit numpy happens to require cython. It can be installed either via pip
pip install cython
or downloaded from here http://cython.org/#download and setup manually like above
sudo python setup.py

Categories

Resources