0

I try to install PyTables package using easy_install.

My problem is that I am not root on the system and am not allowed to write to /usr/local/lib/python2.7/dist-packages/ directory.

To solve this problem I decided to install locally. For that I have created a new directory: /home/myname/mylibs. Then I executed easy_install -d /home/myname/mylibs tables. As a result easy_install complained about the PYTHONPATH environment variable. To resolve this problem I added my new directory to the PYTHONPATH and repeated the previous command. As a result I get syte.py and syte.pyc file in my /home/myname/mylibs directory.

However, when I try import tables from Python it still does not work. What also worries me is that the new files do not have "table" in their names as well in their content.

Can anybody, please, explain me what is going on?

Roman
  • 124,451
  • 167
  • 349
  • 456

1 Answers1

0

I had a similar problem recently trying to use easy_install to put packages in a location I had write-access to. Like you, I had to add the location to my PYTHONPATH variable to get it to install. It was then necessary to set PYTHONPATH every time I wanted to run a command using the installed package(s).

For example, to install and use the flask package I needed to do this:

$ PYTHONPATH=/tmp easy_install -d /tmp flask
$ PYTHONPATH=/tmp python -c 'import flask; print(flask.__version__)'
0.10.1

Without the PYTHONPATH variable set you'd get an error:

$ python -c 'import flask; print(flask.__version__)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named flask

You can of course set the variable permanently by running: $ export PYTHONPATH=/tmp

Or putting export PYTHONPATH=/tmp in your ~/.bashrc file.

grahamlyons
  • 687
  • 5
  • 15