1

I am trying to install dropbox on my university host, and that requires python module docutils. So, after downloading the module and running python install.py I get the following output:

running install
running build
running build_py
running build_scripts
running build_data
running install_lib
creating /usr/local/lib/python2.7/dist-packages/docutils
error: could not create '/usr/local/lib/python2.7/dist-packages/docutils': Read-only file system

Not surprising really, I can't do any writing outside my home directory. My question is - is there a way to install it in my home folder?

Thanks

1

3 Answers 3

3

With the latest version of pip, one way to do it is:

pip install --user project
Sign up to request clarification or add additional context in comments.

4 Comments

Hey, I tried 'pip install -t ./docutils docutils-0.10.tar.gz' - got a lot of warnings but also 'Successfully installed docutils'. When running dropbpx ./configure I have the same problem - ot doesn't recognize the module. Does pip let python interpreter know that there's a module isntalled locally, or do I have to specify it when I import it?
-t requires an install location; --user should put it somewhere that Python already looks for modules (where possible).
So if I type '--user ~/modules' flag I tell python to look for modules in '~/modules'?
no, --user doesn't take an argument; pip and python know where your user python modules directory should be.
2

The best way to circumvent system level modifications/additions when acquiring python modules is to use virtualenv and its wrapper, to make it easier, virtualenvwrapper, along with pip. Perhaps these are already installed? Try

$ mkvirtualenv dropboxEnv # or whatever you want to call it
$ workon dropboxEnv       # to activate the virtual environment

and/or

$ pip install docutils

if you don't have pip you can first try

$ easy_install pip

AFAIK, a virtualenv is the only way to "install" a module into your home folder. Trying to get virtualenv/virtualenvwrapper installed might be a good option. If those aren't already installed, you might try to find someone to install those on your machine system-wide, then you would be able to create any virtualenvs and install any modules you want into your home folder.

3 Comments

virtualenv is convenient but not the only way to install a Python module into your home folder. An other answer mentions the --user configuration option supported by Distutils and pip. You can also use the PYTHONPATH enviornment variable or dynamically sys.path.
Nice. Didn't know about the --user tag. Thanks. I am aware of PYTHONPATH, but what do you mean by "you can also use the PYTHONPATH environment variable?" in this scenario?
You can install Python modules in any directory and then set PTYHONPATH to add that directory to the search path Python uses when importing modules. There are times when that may be more appropriate than using a virtualenv. But, for many use cases, virtualenv is simpler.
0

If you have downloaded version try this

python setup.py install --user

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.