Error in creating virtualenv in ubuntu 16.04.2 LTS - linux

Hello I am getting following error during virtualenv creation.
Here is the error:
$ mkvirtualenv cv
ERROR: virtualenvwrapper could not find /usr/local/bin/virtualenv in your path
Before this I was getting some weird message during the run of following commands:
sudo python get-pip.py
sudo pip install virtualenv virtualenvwrapper
Here is the weird message:
The directory '/home/myusername/.cache/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 '/home/myusername/.cache/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.
If I run this command sudo apt install virtualenv or virtualenvwrapper then I don't get the above weird message. but this don't help me to create virtualenv
python path is /usr/bin/python
Can anybody help me to figure out the issue by providing detailed command?

First, let's clear your "weird" message. It means that you've already used sudo -H before and sudo changed ownership for some of your files to root. Take the files back with the command
sudo chown -R myusername /home/myusername
(change myusername to your real login name; I used the name you've used in your question.)
After that upgrade pip and follow installation instructions for virtualenv and virtualenvwrapper:
sudo pip install -U pip setuptools virtualenv virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh

Related

pip3 install --force-reinstall -r requirements.txt error in Amazon EC2

Try to install requirements.txt in Amazon EC2
pip3 install --force-reinstall -r requirements.txt
But get the following error messages
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.
Defaulting to user installation because normal site-packages is not writeable
Processing /opt/concourse/worker/volumes/live/fdab5f8f-d9cf-4e28-48c7-38c4ee85b3c3/volume/cffi_1606255125152/work
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/opt/concourse/worker/volumes/live/fdab5f8f-d9cf-4e28-48c7-38c4ee85b3c3/volume/cffi_1606255125152/work'
I saw this post error when "sudo pip" on an AWS ec2 instance
here are some PATH variables
echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin:/home/ec2-user/bin
sudo grep secure_path /etc/sudoers
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
so I tried
sudo grep secure_path /etc/sudoers
sudo env "PATH=$PATH" pip3 install --force-reinstall -r requirements.txt
But get the following error messages instead
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Invalid requirement: 'cffi # file:///opt/concourse/worker/volumes/live/fdab5f8f-d9cf-4e28-48c7-
38c4ee85b3c3/volume/cffi_1606255125152/work'
It looks like a path. Does it exist ?
Could anyone help? thank you!

python installing bluepy to virtualenv

I'm a *nix noob. I'm on Ubuntu 16.04.
I'm trying to install bluepy to a virtualenv. It is currently installed under my user (not a virtualenv). When running pip freeze I see it listed under my user. When I activate the virtualenv and run pip freeze it does not show up. I tried to install it under the virtualenv using the following command: sudo pip3 install bluepy. It returns this:
The directory '/home/todd/.cache/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 '/home/todd/.cache/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.
I'm not sure what to do. If responding please add explanations so I can learn something. Thanks!
EDIT:
This answer did not help solve my problem. It was tailored for a Mac OS, not Ubuntu.
pip install: Please check the permissions and owner of that directory

Cannot run jupyter notebook in Ubuntu

I have installed jupyter notebook using:
sudo pip3 install jupyter
It seemed to work but I got the error:
The directory '/home/user1/.cache/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 '/home/user1/.cache/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
When I run it:
jupyter notebook
I get the error:
Error executing Jupyter command 'notebook': [Errno 8] Exec format error
Try:
pip3 install jupyter --user
This will install jupyter to your home directory. This removes the ownership issue. In my case the installation directory is:
~/.local/lib/python3.6/site-packages.
I use Linux Mint, which is a fork of Ubuntu.

Accidentaly ran pip with sudo

After that I always get permission error when trying to install anything with pip. Is there any way to safely return everything back to normal?
You have run sudo -H pip install; sudo ran pip as root and pip changed ownership of some files and directories under your home dir. Take the files back:
sudo chown -R $USER $HOME

Running conda install as an admin on my ubuntu server, I get "Missing write permissions: /home/ubuntu/anaconda3"

I have installed Anaconda3 on my ubuntu server.
When I attempt to install or upgrade any package using conda, for example:
conda install numpy=1.11.0
(of course you cannot do "sudo conda")
I receive the following error:
Error: Missing write permissions in: /home/ubuntu/anaconda3
#
# You don't appear to have the necessary permissions to install packages
# into the install area '/home/ubuntu/anaconda3'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=/home/ubuntu/anaconda3
As #cel pointed out, providing the correct permissions is all that is necessary:
sudo chown -R ubuntu /home/ubuntu/anaconda3
sudo chmod -R +x /home/ubuntu/anaconda3

Resources