Unable to install gittle library without root privileges - python

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.

Related

How to fix ‘“ERROR: Command errored out with exit status 1:” when trying to install watchdog using pip

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.

installing matplotlib on gcp vm

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

Bluepy Installation Error

I am trying to install bluepy 1.0.5. However, I get receiving error below. Any idea how can i solve it? (I am using Mac OS X El Capitan)
40:449: execution error: The directory '/Users/isozyesil/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 '/Users/isozyesil/Library/Caches/pip' 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.
Command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/95/f900ttf95g1b7h02y2_rtk400000gn/T/pycharm-packaging669/bluepy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/95/f900ttf95g1b7h02y2_rtk400000gn/T/pip-djih0T-record/install-record.txt --single-version-externally-managed --compile
failed with error code 1 in /private/var/folders/95/f900ttf95g1b7h02y2_rtk400000gn/T/pycharm-packaging669/bluepy/
(1)
You need to install libglib2.0-dev and python3-dev before:
sudo apt-get install libglib2.0-dev python3-dev
What part of the diagnostic message did you find unclear?
Did you consider ensuring writable self-owned files by doing sudo chown -R isozyesil /Users/isozyesil/Library/Caches/pip ?
Did you consider sudo pip install bluepy ?
For python 2.X this:
$ sudo apt-get install python-pip libglib2.0-dev
$ sudo pip install bluepy
to install dependencies and bluepy.
If you're intending to use it with python3.x use pip3 to install.

Unable to install Google-Earth-Engine-Api in Linux subsystem for Windows

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.

Downloading Requests for python error on ubuntu

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.

Categories