hughperkins / pytorch

Python wrappers for torch and lua
BSD 2-Clause "Simplified" License
431 stars 70 forks source link

permission denied: python setup.py install #8

Closed moon6pence closed 8 years ago

moon6pence commented 8 years ago

I have python 2.7 which installed by default in Ubuntu 14.04 And torch is installed in my home directory.

When I run the script build.sh, there's permission denied error like below:

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-18167.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python2.7/dist-packages/

This is obvious because python setup.py install tend to install below /usr/local/lib/python2.7 sudo ./build.sh also fails because it cannot find the torch when I use sudo.

My solution was update the last line of build.sh like this:

python setup.py install --user || exit 1

pytorch package is installed below my home directory and it works well.

However, how do you install this package in general situation?

hughperkins commented 8 years ago

What I do personally is like:

sudo apt-get install python-virtualenv python2.7-dev
virtualenv -p python2.7 ~/env27
source ~/env27/bin/activate
pip install -U pip
pip install -U wheel
pip install -U setuptools
pip install -U numpy
pip install -U docopt
source ~/torch/install/bin/torch-activate
git clone https://github.com/hughperkins/pytorch ~/pytorch
cd ~/pytorch
./build.sh
hughperkins commented 8 years ago

To what extent does this meet your requirements for your own system?

sounakdey commented 8 years ago

thanks moon6pence for the solution it worked for me

hughperkins commented 8 years ago

Addressed in 05b09e3 :

hughperkins commented 8 years ago

Thank you Kyunghun and Sounak; I confess I didnt know about --user before :-)

Hostilesmh commented 6 years ago

thanks moon6pence for the solution it worked for me

liyansasongko commented 4 years ago

python setup.py install --user || exit 1 worked for me

AbdellaouiMohamedFawzi commented 4 years ago

If you're on windows just run cmd or power shell as administrator

cmal commented 4 years ago

When using virtualenv(no matter whether we have ||exit 1): $ source ~/py36/bin/activate $ python setup.py install --user [|| exit 1] ... ... running install_egg_info running egg_info error: [Errno 13] Permission denied $ which python /home/cmal/py36/bin/python $ python --version Python 3.6.12 $ which pip /home/cmal/py36/bin/pip $ pip -V pip 20.0.2 from /home/cmal/py36/lib/python3.6/site-packages/pip (python 3.6)