Unable to install numpy for python 3.6.5 - numpy

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

Related

"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 pip udate 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.

Issue while installing Tensorflow via Jupyter Notebook

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\~-mpy\\core\\multiarray.cp37-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
Although when I tried python -m pip install tensorflow in command prompt it installed the packagen, when I am trying to import Keras in Jupyter notebook I am getting above error.
It looks like you are on Windows. Open your command prompt as administrator and then type python -m pip install tensorflow --user. Let me know if this fixed your issue.

How to fix "Consider using the `--user` option or check the permissions" error?

I am installing TensorFlow in anaconda prompt but it stops due to the permission. I was wondering if anyone knows what should I do to fix that.
The commands I am using:
pip install --user virtualenv
pip install --upgrade tensorflow
The error that I get:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\scipy\\cluster\\hierarchy.py'
Consider using the `--user` option or check the permissions.

AWS Lambda function requires numpy - but yields "Importing the multiarray numpy extension module failed." error

On Mac I installed numpy via:
sudo pip install -t /mydirectoryhere/ numpy
with:
Password:
The directory '/Users/elliotbricker/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/mydirectoryhere/' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting numpy
Downloading https://files.pythonhosted.org/packages/e7/c1/d5c47de35e366b1c2f60da88a24b25d3037b892417c5c3c5398313fb54f5/numpy-1.15.1-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 (24.5MB)
100% |████████████████████████████████| 24.5MB 762kB/s
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: numpy
Successfully installed numpy-1.15.1
Then when I archived the package for Lambda and ran the TEST on AWS for this Lambda function, I get:
{
"errorMessage": "\nImporting the multiarray numpy extension module failed. Most\nlikely you are trying to import a failed build of numpy.\nIf you're working with a numpy git repo, try git clean -xdf (removes all\nfiles not under version control). Otherwise reinstall numpy.\n\nOriginal error was: /var/task/numpy/core/multiarray.so: invalid ELF header\n",
"errorType": "ImportError",
"stackTrace": [
The above pip install produced three directories:
bin
numpy
numpy-1.15.1.dist-info
My compressed archive contains all three of the above directories