Cannot pip udate numpy - numpy

I want to update numpy from 1.19.1 to 1.19.2. So I did the following command:
pip install --upgrade numpy
However, I received the following error message:
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/userdata/data-dlin/.conda/envs/mybase/lib/python3.7/site-packages/numpy-1.19.1.dist-info/RECORD'
I went to the directory and found the RECORD file was indeed missing. How do I fix the error?

Uninstalling numpy (pip uninstall numpy), then deleting the entire folder
(python environment)/lib/site-packages/numpy-1.19.X.dist-info
And reinstalling numpy (pip install numpy) fixed it for me.

Related

Can't install lxml on pip

I can't install lxml on pip or pip3
I tried run the code on python3.11
import pandas as pd
data = pd.read_html("https://zh.wikipedia.org/zh-hans/%E6%81%92%E7%94%9F%E6%8C%87%E6%95%B8")
It occurred a Import Error.
"ImportError: lxml not found, please install it"
So I tried to install the lxml. "pip install lxml"
However, it cannot be install.
** note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> lxml
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.**
And then, I had download the lxml-4.9.9-pp38-....whl
and entered "pip install c:/......." and it said whl is not a supported wheel on this platform.
Could someone do me a favor?

"Bad file descriptor" error when upgrading numpy on a-Shell

I installed a-Shell on my iPad(8th gen), it came with very nice python packages and it allowed me to run Jupyter notebook smoothly. But a lot of packages are outdated and my problem is with numpy.
When I use:
pip3 install numpy --upgarde
or
pip3 install numpy --upgarde --ignore-installed
It gives me the following:
OSError: [Errno 9] Bad file descriptor
note: This error originates from a subprocess, and is likely not a problem with pip.
Does file access permissions has to do anything with this problem?
One solution I found is to remove and re-install python, but I don't want to do that.
Thanks.

Cannot uninstall numpy 1.21.2, RECORD file not found

I encountered a problem while installing
pip install pytorch-nlp
The erro is as follow:
ERROR: Could n`ot install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\users\\pcpcpc\\anaconda3\\envs\\pytorch\\lib\\site-packages\\numpy-1.21`.2.dist-info\\METADATA'
SO I tried to reinstall numpy by
pip install --force-reinstall --no-deps numpy==1.21.2
But I get the error:
ERROR: Cannot uninstall numpy 1.21.2, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.21.2'.
As #Phoenix suggested, you might have an incomplete installation of numpy in your site-packages folder.
Find your site-packages folder.
SITE_PACKAGES_FOLDER=$(python3 -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")
echo $SITE_PACKAGES_FOLDER
Check for extraneous numpy packages from your site-packages folder.
ls $SITE_PACKAGES_FOLDER/numpy*
Trash extraneous packages.
pip install trash-cli
trash $SITE_PACKAGES_FOLDER/numpy*
Reinstall numpy.
pip install --upgrade numpy
Try manually deleting the numpy files/directories and then do
pip install --upgrade --force-reinstall <package>
One way to find the numpy files is to run
python -c "import numpy; print(numpy.__file__)"
For example, this prints out
/home/tink-user/workspace/.conda_envs/tink-payment-categorization/lib/python3.7/site-packages/numpy/__init__.py
for me. So you can go there:
cd /home/tink-user/workspace/.conda_envs/tink-payment-categorization/lib/python3.7/site-packages
then you can check with something like this to see which numpys are there:
ls numpy*
ls | grep numpy
Delete the numpy directories and try force reinstalling (pip install --upgrade --force-reinstall <package>).
Conda
This also happened to me in a conda environment after I ended up with multiple numpy installations and tried to manually delete them by removing the directories in site-packages. I had to force reinstall with conda (I think after manually deleting the directories for numpy): conda install numpy --force-reinstall.
None of the above solutions worked for me
What worked for me:
Delete that particular folder from the site-packages
Only delete the folder with the version number and not the folder that has python modules and files
Delete that folder with metadata files matching the numpy version in the warning and error message in the installation traceback
re-install the package
pip install numpy just as you would do
this work for both cases
global environment
local or project related environment
** else you will have delete that environment and create a new one **

Unable to install numpy for python 3.6.5

I'm trying to install numpy with the command pip3 install numpy
But I get the following error:
Collecting numpy
Using cached https://files.pythonhosted.org/packages/35/d5/4f8410ac303e690144f0a0603c4b8fd3b986feb2749c435f7cdbb288f17e/numpy-1.16.2-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: numpy
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/numpy-1.16.2.dist-info'
Consider using the `--user` option or check the permissions.
It says permission denied so I ran it with sudo and it installed properly.
However when I use any script which uses numpy as python3 abc.py I get an error saying no module named numpy. It works well with sudo
How do I install numpy to be used without sudo?
I am running python 3.6.5 on Ubuntu 18.04

Tensorflow installation error

I am trying to install tensorflow with virtualenv
I have successfully went through the first 5 steps but on the 5th
pip install --upgrade tensorflow
I am getting an error
Found existing installation: numpy 1.8.0rc1
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling numpy-1.8.0rc1:
OSError: [Errno 1] Operation not permitted: '/tmp/pip-Z5MKQS-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'
You might be installing globally try adding sudo
sudo pip install --upgrade tensorflow
Otherwise just upgrade numpy separately with sudo and then you can try to install tensorflow locally.
I have no idea why you have that error.
But you can try with first installing pip3 and then try install with pip3 as
pip3 install --upgrade tensorflow
This will help you.