Error installing Pillow (Django) - python

I'm having trouble getting Pillow to install.
Here's the full traceback:
Collecting Pillow
Using cached Pillow-4.0.0-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
Collecting olefile (from Pillow)
Using cached olefile-0.44.zip
Installing collected packages: olefile, Pillow
Running setup.py install for olefile ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-build-UyBMYN/olefile/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-QHsEXV-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib
copying OleFileIO_PL.py -> build/lib
creating build/lib/olefile
copying olefile/__init__.py -> build/lib/olefile
copying olefile/olefile.py -> build/lib/olefile
copying olefile/README.rst -> build/lib/olefile
copying olefile/README.html -> build/lib/olefile
copying olefile/LICENSE.txt -> build/lib/olefile
copying olefile/CONTRIBUTORS.txt -> build/lib/olefile
running install_lib
creating /Library/Python/2.7/site-packages/olefile
error: could not create '/Library/Python/2.7/site-packages/olefile': Permission denied
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-build-UyBMYN/olefile/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-QHsEXV-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/bt/_3d4816x12d95tzvcp_0302w0000gn/T/pip-build-UyBMYN/olefile/
The error seems to be 'Permission denied' when attempting to create the folder; though I cannot understand why...
My machine is running Mac OSX, and I'm using Terminal to run the commands for this Django project.

Because the normal user doesn't have permission to install packages globally. Either run with sudo, or - much better - use a virtualenv and install your packages in there.

There're several questions regarding this problem, I'd suggest to take a look at these:
Using virtualenv https://stackoverflow.com/a/19472082/394647
Using $HOMEhttps://stackoverflow.com/a/7143496/394647
I prefer the second one but it also depends on your project/app structure

Related

I encountered an error when trying to install mod_wsgi apache module

I'm using Bitnami WAPP (Windows, Apache, PostgreSQL, PHP) Stack as a development environment and I need to install mod_wsgi in order to use pgAdmin4 - an RDBMS for PostgreSQL (similar to MySQL Workbench). But when I tried to install it using pip install mod_wsgi it returns the following error:
C:\WINDOWS\system32>pip install mod_wsgi
Collecting mod_wsgi
Using cached https://files.pythonhosted.org/packages/47/69/5139588686eb40053f8355eba1fe18a8bee94dc3efc4e36720c73e07471a/mod_wsgi-4.6.5.tar.gz
Installing collected packages: mod-wsgi
Running setup.py install for mod-wsgi ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\justin~1\appdata\local\temp\pip-install-myppun\mod-wsgi\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\justin~1\appdata\local\temp\pip-record-xtudvn\install-record.txt --single-version-externally-managed --compile:
c:\python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\mod_wsgi
copying src__init__.py -> build\lib.win-amd64-2.7\mod_wsgi
creating build\lib.win-amd64-2.7\mod_wsgi\server
copying src\server\apxs_config.py -> build\lib.win-amd64-2.7\mod_wsgi\server
copying src\server\environ.py -> build\lib.win-amd64-2.7\mod_wsgi\server
copying src\server__init__.py -> build\lib.win-amd64-2.7\mod_wsgi\server
creating build\lib.win-amd64-2.7\mod_wsgi\server\management
copying src\server\management__init__.py -> build\lib.win-amd64-2.7\mod_wsgi\server\management
creating build\lib.win-amd64-2.7\mod_wsgi\server\management\commands
copying src\server\management\commands\runmodwsgi.py -> build\lib.win-amd64-2.7\mod_wsgi\server\management\commands
copying src\server\management\commands__init__.py -> build\lib.win-amd64-2.7\mod_wsgi\server\management\commands
creating build\lib.win-amd64-2.7\mod_wsgi\docs
copying docs_build\html__init__.py -> build\lib.win-amd64-2.7\mod_wsgi\docs
creating build\lib.win-amd64-2.7\mod_wsgi\images
copying images__init__.py -> build\lib.win-amd64-2.7\mod_wsgi\images
copying images\snake-whiskey.jpg -> build\lib.win-amd64-2.7\mod_wsgi\images
running build_ext
building 'mod_wsgi.server.mod_wsgi' extension
error: INCLUDE environment variable is empty
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\justin~1\appdata\local\temp\pip-install-myppun\mod-wsgi\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\justin~1\appdata\local\temp\pip-record-xtudvn\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\justin~1\appdata\local\temp\pip-install-myppun\mod-wsgi\
I've also run this command before the above command
set "MOD_WSGI_APACHE_ROOTDIR=C:/Bitnami/wappstack-7.1.25-0/apache2"
How can I fix it? Please help... Thank you!

"pip install" permission denied on Mac

I tried to install the base65536 module, by typing this into Terminal:
pip install base65536
Yet it produced this error:
Collecting base65536
Using cached base65536-0.1.1.tar.gz
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from base65536)
Installing collected packages: base65536
Running setup.py install for base65536 ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/2h/n5zk2_w50273k4hdxw8l05240000gn/T/pip-build-tl_DyR/base65536/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/2h/n5zk2_w50273k4hdxw8l05240000gn/T/pip-ZZqmm6-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/base65536
copying base65536/about.py -> build/lib/base65536
copying base65536/init.py -> build/lib/base65536
copying base65536/core.py -> build/lib/base65536
running install_lib
creating /Library/Python/2.7/site-packages/base65536
error: could not create '/Library/Python/2.7/site-packages/base65536': Permission denied
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/2h/n5zk2_w50273k4hdxw8l05240000gn/T/pip-build-tl_DyR/base65536/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/2h/n5zk2_w50273k4hdxw8l05240000gn/T/pip-ZZqmm6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/2h/n5zk2_w50273k4hdxw8l05240000gn/T/pip-build-tl_DyR/base65536/
How can I fix this?
Thats because you dont have admin permissions.
try this
sudo pip install base65536
When it says Permission Denied that means that you are not an administrator on your computer and therefore cannot do this. Try running as administrator. If you are using windows, right click on app and select 'Run as Administrator'. If you are using mac, and you are not the administrator on your computer, type su (Whatever the name of the admin. user is)
For example, su adminUsername
Then type
pip install base65536

i am getting this error when I try to download pip install tweepy through my terminal

copying tweepy/error.py -> build/lib/tweepy
copying tweepy/models.py -> build/lib/tweepy
copying tweepy/oauth.py -> build/lib/tweepy
copying tweepy/parsers.py -> build/lib/tweepy
copying tweepy/streaming.py -> build/lib/tweepy
copying tweepy/utils.py -> build/lib/tweepy
running install_lib
creating /Library/Python/2.7/site-packages/examples
error: could not create '/Library/Python/2.7/site-packages/examples': Permission denied
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/zq/k3pbc5v57gn07qqg7qxxnrmm0000gn/T/pip-build-R8mYNT/tweepy/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/zq/k3pbc5v57gn07qqg7qxxnrmm0000gn/T/pip-ZdPzhK-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/zq/k3pbc5v57gn07qqg7qxxnrmm0000gn/T/pip-build-R8mYNT/tweepy/
The Python installation is outside of your '/home/username/' directory. You need to use root privileges give you permission to access the directory.
$ sudo pip install tweety
Using sudo as above will just apply the command(s) that follow it.

pip install on mac runs into version error

I'm trying to install a python package with pip, but it thinks I have a different Mac version than I actually do:
pip install root_numpy
Collecting root-numpy
Using cached root_numpy-4.4.1.tar.gz
Building wheels for collected packages: root-numpy
Running setup.py bdist_wheel for root-numpy ... error
Complete output from command /Users/mattzhang/py3_kernel/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/38/2_qkncsd1hlgd2871lnmrgw80000gn/T/pip-build-xexox4xy/root-numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/38/2_qkncsd1hlgd2871lnmrgw80000gn/T/tmpawn1rjqlpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.5
creating build/lib.macosx-10.6-intel-3.5/root_numpy
copying root_numpy/__init__.py -> build/lib.macosx-10.6-intel-3.5/root_numpy
copying root_numpy/_array.py -> build/lib.macosx-10.6-intel-3.5/root_numpy
...
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
The issue here is that I'm using Yosemite version 10.10.5, but pip thinks I'm using 10.6. What can I do to correct this?
Try to set deployment target
export MACOSX_DEPLOYMENT_TARGET=10.10 and then again do pip install root_numpy.

Access denied message when tried to install python module

When i tried installing oauth module in python using pip
pip install oauth
I get this error
Downloading/unpacking oauth
Downloading oauth-1.0.1.tar.gz
Running setup.py (path:/tmp/pip_build_mounarajan/oauth/setup.py) egg_info for package oauth
Installing collected packages: oauth
Running setup.py install for oauth
error: could not create '/usr/local/lib/python2.7/dist- packages/oauth': Permission denied
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_mounarajan/oauth/setup.py';exec(compile( getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-N_OqTH-record/install- record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/oauth
copying oauth/__init__.py -> build/lib.linux-x86_64-2.7/oauth
copying oauth/oauth.py -> build/lib.linux-x86_64-2.7/oauth
running install_lib
creating /usr/local/lib/python2.7/dist-packages/oauth
error: could not create '/usr/local/lib/python2.7/dist- packages/oauth': Permission denied
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_mounarajan/oauth/setup.py';exec(compile( getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-N_OqTH-record/install- record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_mounarajan/oauth
Storing debug log for failure in /home/mounarajan/.pip/pip.log
How could i change the permissions for python directory?
Thid problem accours when i try to install any module using pip
You might want to use sudo for installing modules using pip.

Categories