I'm running ubuntu on my computer and I'm trying to download requests.
However, when I do pip install requests it gives me an error:
writing manifest file 'requests.egg-info/SOURCES.txt'
running install_lib
creating /usr/local/lib/python2.7/dist-packages/requests
error: could not create '/usr/local/lib/python2.7/dist-packages/requests': Permission denied
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/alejandro/build/requests/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-tT3Boe-record/install-record.txt failed with error code 1
Does anyone have any tips on how to get past this or fix it?
Your error
could not create '/usr/local/lib/python2.7/dist-packages/requests': Permission denied
suggests that you tried to install the package system-wide as a regular user - which you don't have permission to do.
You can either install the package just for yourself with the --user option:
pip install --user requests
... or install it system-wide as root using sudo:
sudo pip install requests
Alternatively, you could look into using a virtual environment.
Related
I am revisiting the python language and experiencing difficulty setting up my environment.
I am using
- Mac Mojave (10.14)
- python 2.7.10 (packaged with the system)
- python 3.7.4 (installed using homebrew)
- homebrew 2.1.14
- pip 19.2.3
I encounter an error message when attempting to install watchdog via pip. I believe the error is caused by pip attempting to install in python 2.7 folders (without sufficient permissions) instead of the python 3 folder
I have tried uninstalling, reinstalling and upgrading python 3
I encounter the following error message when attempting to install watchdog via pip
1 error generated.
Error compiling module, falling back to pure Python
running install_lib
creating /Library/Python/2.7/site-packages/yaml
error: could not create '/Library/Python/2.7/site-packages/yaml': Permission denied
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4d/spq3r5t92654252ql994_l540000gr/T/pip-install-nqmq6O/PyYAML/setup.py'"'"'; __file__='"'"'/private/var/folders/4d/spq3r5t92654252ql994_l540000gr/T/pip-install-nqmq6O/PyYAML/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4d/spq3r5t92654252ql994_l540000gr/T/pip-record-g8Qjzh/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
You need to upgrade setuptools and pip. You can do that by running:
pip install -U pip setuptools
When you run pip install, exactly which pip gets used depends on several things like your PATH, shell, shell configuration, and operating system.
The best thing to do is invoke pip using <python> -m pip where <python> is the Python that you want to install the package for. For example, if you run python3 to use the Python that you want to install the package for, then run python3 -m pip.
If you're running python3 -m pip install ... and getting permission errors, then you can execute python3 -m pip install --user ..., which will install it to your user site-packages directory and available when you execute python3 under your user.
I tried to install matplotlib ( third party lib) on gcp vm and failed.
gcp vm python documantation says use pip install -t lib/ <library_name> but actually, what they really mean: i.g. use pip install matplotlib -t lib/ <library_name> And it didn't work
I tried:
sudo pip install matplotlib -t env/gcplib
result:
"**Failed building wheel for subprocess32**"
"Command "/usr/bin/python -u -c "import setuptools,
tokenize;__file__='/tmp/pip-install-Rpkv8i/subprocess32/setup.py
';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fi
le__, 'exec'))" install --record /tmp/pip-record-x4Y1E4/install-record.txt --single-version-externally-managed --co
mpile" **failed with error code 1** in /tmp/pip-install-Rpkv8i/subprocess32/"
I will very appreciate any help
Before attempting to install matplotlib, you need to install python-dev. You didn't mention what OS your VM was, but if it's Ubuntu, you would do that with:
sudo apt-get install python-dev
Ok, I've installed Linux subsystem in my Windows 10 and now following this tutorial to install google earth engine inside my Linux subsystem.
When I try to run following command to install GEE API, I get following error (I am getting the same error for "sudo pip install 'pyOpenSSL>=0.11'" command as well.):
sudo pip install earthengine-api
> Command "/usr/bin/python -u -c "import setuptools,
> tokenize;__file__='/tmp/pip-build-PrUuzi/cryptography/setup.py';f=get
> attr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
> '\n');f.close();exec(compile(code, __file__, 'exec' ))" install
> --record /tmp/pip-3eTIvM-record/install-record.txt --single-version-externally-managed --compile" failed wit h error code 1 in /tmp/pip-build-PrUuzi/cryptography/
Then after failing this, I tried to manually download and install the GEE setup.
I copied the downloaded compressed package to folder: "C:\Users\Saurabh\AppData\Local\lxss\home\saurabh"
and then tried to do the ls -a to see if I can see the file or not. But it is not visible:
What I am doing wrong here?
As mentioned in this thread, I updated setuptools and pip to the latest versions and I am finally able to run the earthengine-api without any issue.
I'm getting an error after installing MySQL Connector for Python 2.7.9 in Linux OS.
Command /usr/bin/python -c "import setuptools,
tokenize;file='/tmp/pip-build-5nxFZ_/mysql-connector-python-rf/setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record /tmp/pip-qLvsiw-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-5nxFZ_/mysql-connector-python-rf
Storing debug log for failure in /home/pi/.pip/pip.log
Searched a lot about this error couldn't find a satisfactory solution, please help me to sort out this error.
Thank you. :)
use
pip install mysqlclient
as Mysql-Python and all are not supported now. install mysql in linux and install the connector to connect to local mysql
try this ,
pip install MySQL-python==1.2.5 # version specified
or
pip install MySQL-python
if you already installed required systems for python 2.7. Next, You should run this command:
sudo apt-get install python2.7-mysqldb
I followed this link to install Gittle library. But when I run a command
$ pip install gittle
I get an error:
Command /usr/bin/python -c "import setuptools,
tokenize;__file__='/tmp/pip_build_victor
/gittle/setup.py';exec(compile(getattr(tokenize, 'open',
open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-aoyPEt-record/install-record.txt
--single-version-externally- managed --compile failed with error code 1 in /tmp/pip_build_victor/gittle Storing debug log for failure in
/home/victor/.pip/pip.log
My Python version is 2.7.6.
You Need Root Privileges
Since you are installing sistem-wide libraries, these usually will be placed in directories which need root privileges for writing in them (for example anything under /usr/lib). Hence you need to either run the command as root:
# pip install gittle
Or you can use sudo:
$ sudo pip install gittle
What About Virtual Environments?
The more efficient/pythonic way to go about this would be using virtual environments. This is especially true if you are installing project-specific libraries, which will most probably not be required by other projects. Another classical application of virtual environments is when you are working on a machine on which you don't have root privileges, say at university for example.
Once you set up a virtual environment, if you place it in a directory on which you have writing rights, you can run:
$ pip install gittle
to install gittle in this case.