Could not install packages due to an EnvironmentError in ec2 server - django

i'm typing the following in my working amazon ec2 linux server. (with ENV activated)
pip install pillow
getting this error:
Could not install packages due to an EnvironmentError:
[Errno 13] Permission denied: '/home/ec2-user/env/lib64/python3.5/site-packages/Pillow-5.1.0.dist-info'.
Consider using the `--user` option or check the permissions.
if i use --user i get:
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

Based on your answers, what happened is that you used sudo when you created the virtualenv so root owns it.
sudo chown ec2-user:ec2-user -R ~ec2-user/env will fix this and make ec2-user the owner of the directory (and subdirectories) again.

Related

permission denied : while installing django in windows

permission denied
I was trying to install Django using pip3 install django==2.0.2 on windows.
But I am getting "permission denied " error message.
But pip3 install django==2.0.2 --user is working, but "Django-admin" command is not being recognized.
Please help me out.
C:\Users\Hima>pip3 install django==2.0.2
fd = os.open(file, os.O_RDWR | os.O_CREAT | os.O_EXCL)
PermissionError: [Errno 13] Permission denied: 'c:\\program files (x86)\\python38-32\\Lib\\site-packages\\accesstest_deleteme_fishfingers_custard_gijd2m'
Your installation with --user argument works because --user makes pip install packages in your home directory instead of system directory, which doesn't require any special privileges. You have not enough privileges to install it to system dir.
If you are sure of what you are doing - run pip with administrative privileges but do remember that anyone can uploade libraries to pip and thus there is a risk of running malicious code.
Better way to go is to use a virtual environment

Virtual Environment installation Error

When I try to install a virtual environment in my local system I'm getting this error. Could you please help me out to fix this issue?
$ pip -V
pip 9.0.1 from /home/sysadmin/.local/lib/python2.7/site-packages (python 2.7)
$ sudo pip install virutalenv
sudo: unable to resolve host sysadmin-Veriton-M200-H61
The directory '/home/sysadmin/.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/sysadmin/.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.
Collecting virutalenv
Could not find a version that satisfies the requirement virutalenv (from versions: )
No matching distribution found for virutalenv
You have a typo there. It's virtualenv, not virutalenv.
Also, since you already have pip installed in .local, please don't install virtualenv using sudo.
Just
$ pip install --user virtualenv
should do, and virtualenv will be available in your user directory (~/.local/bin if memory serves, but find ~ -type f -name virtualenv will find it for you).

How do I install dataset on python not using pip or easy_install?

I'm trying to install data set on Ubuntu and when I use
pip install dataset
it gives me a long error message, and from what I could debug from it is that permission to the directory is denied. When I try
easy_install dataset
it says error: can't create or remove files in install directory because permission is denied Maybe my account doesn't have write access to this directory?
If you're receiving the error can't create or remove in install directory because permission is denied then you need to run your commands with sudo privileges
Try:
sudo pip install dataset
or
sudo easy_install dataset

Permissions warning with sudo pip install

I am using an ubuntu 14.04 64bit machine. The system python is 2.7.6.
This is what happens when I try to pip install anything
thekindlyone#deepthought:~$ sudo pip install pyopenssl
The directory '/home/thekindlyone/.cache/pip/log' or its parent directory is not owned by the current user and the debug log 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/thekindlyone/.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/thekindlyone/.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.
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /usr/lib/python2.7/dist-packages
pip is at 6.1.1
How do I get rid of these warnings?
Perhaps you want to use the sudo '-H' option to set the HOME environment variable to the home directory specified by the target user's password database entry.
That way, pip will use a cache directory in your root users home.
eg.
$ sudo -H pip install pyopenssl

Webfaction setup Virtualenv

I've got to setup a new Django website on a webfaction account, getting issues when I try to run pip this is the error I get when I run
pip install south
OSError: [Errno 13] Permission denied: '/tmp/pip-build/virtualenv'
Webfaction provides instructions on how to install pip and pip packages for use within your local home directory...
http://docs.webfaction.com/software/python.html#installing-packages-with-pip
If you plan on hosting multiple web applications from the same webfaction server, it's probably wise to setup virtualenvs for each application. To do this, I would try the following...
pip install --user virtualenv # install virtualenv via pip
echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.bashrc # add local bin directory to PATH
source $HOME/.bashrc # reload .bashrc to kick in PATH changes
virtualenv yourvirtualenv --no-site-packages
Hopefully that works. I don't have Webfaction to test but I think that should suffice.