0

I must install a python package/library/module called sonLib from the author's Git repo. It is a dependency of jobTree, which I will also later need. Trouble is it won't install. I've tried 4 methods listed below. Methods 1) and 3) both have the same error which is addressed here, but I could not find an analgous error in his setup.py. Is there one of these errors that is easiest to deal with? Is there perhaps an alternative way to get this (and jobTree) installed so I can import it via the python located in my /usr/bin/python2.7?

Method 1

git clone https://github.com/benedictpaten/sonLib.git
cd /sonLib
sudo python2.7 setup.py install

The Error:

running install
running bdist_egg
running egg_info
creating sonLib.egg-info
writing sonLib.egg-info/PKG-INFO
writing top-level names to sonLib.egg-info/top_level.txt
writing dependency_links to sonLib.egg-info/dependency_links.txt
writing sonLib.egg-info/PKG-INFO
writing top-level names to sonLib.egg-info/top_level.txt
writing dependency_links to sonLib.egg-info/dependency_links.txt
writing manifest file 'sonLib.egg-info/SOURCES.txt'
error: package directory 'sonLib' does not exist

Method 2

sudo pip install -e git://github.com/benedictpaten/sonLib.git

The Error:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/local/lib/python3.3/dist-packages/setuptools-5.7-py3.3.egg/pkg_resources.py", line 356, in load_entry_point
    def has_metadata(name):
  File "/usr/local/lib/python3.3/dist-packages/setuptools-5.7-py3.3.egg/pkg_resources.py", line 2472, in load_entry_point
    Split environment marker, add == prefix to version specifiers as
  File "/usr/local/lib/python3.3/dist-packages/setuptools-5.7-py3.3.egg/pkg_resources.py", line 2186, in load
    #@property
ImportError: No module named 'pip'

Method 3

sudo pip install git+https://github.com/benedictpaten/sonLib.git

The Error:

writing manifest file 'pip-egg-info/sonLib.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
error: package directory 'sonLib' does not exist
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-zbppc3-build
Storing complete log in /home/tjm/.pip/pip.log

Method 4

From a related sonLib installation post on SO.

cd /usr/local/lib/python2.7/site-packages/sonLib
sudo git clone https://github.com/benedictpaten/sonLib.git
sudo make all
make test

The Error:

make[1]: Entering directory `/usr/local/lib/python2.7/site-packages/sonLib/C'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/lib/python2.7/site-packages/sonLib/C'
PYTHONPATH=.. PATH=../../bin:$PATH python allTests.py --testLength=SHORT --logLevel=CRITICAL
Traceback (most recent call last):
  File "allTests.py", line 8, in <module>
    import bioioTest
  File "/usr/local/lib/python2.7/site-packages/sonLib/bioioTest.py", line 69
    print "Got %s levels, %s fileNo and %s maxTempFiles" % (levels, fileNo, maxTempFiles)
                                                       ^
SyntaxError: invalid syntax
make: *** [test] Error 1
Community
  • 1
  • 1
Thomas Matthew
  • 2,826
  • 4
  • 34
  • 58
  • Revalent: http://stackoverflow.com/questions/13622920/installing-a-python-program – The Brofessor Aug 08 '15 at 08:10
  • I stumbled on those installation directions, but it looks like that poster had difficulty adding sonLib to their `PYTHONPATH`. While I have the same (unanswered) question, it still confuses me why a plain ol pip install from this repo fails. – Thomas Matthew Aug 08 '15 at 08:36
  • Yeah, I have yet to have a pip install fail on me like that – The Brofessor Aug 08 '15 at 08:38

1 Answers1

1

The pip-install-command-syntax you're using might be wrong, after https://pip.pypa.io/en/latest/reference/pip_install.html#git it should be:

pip install -e git+https://github.com/benedictpaten/sonLib.git#egg=sonLib

"No module named 'pip'" tells you there's no pip available to the current Python-interpreter. As your examples show, you are using several Python-versions. You installed sonLib with Python-2.7 and then you are trying to use pip of Python-3.3. For a bullet-proof way, use virtenv of Python-2.7 and do:

$ virtenv yourVirtualEnv
$ cd yourVirtualEnv
$ . bin/activate

virtenv will install pip along the way, activating it makes sure you'll have its pip available of the commandline, when barely typing pip. After finishing, deactivating the virtualenv again, is simply:

$ deactivate

Anyway, the activation is not permanently, it will die also, when your shell-session does. Alternatively add the path to your .bashrc, if you want this permanently to be your default pip.

Ida
  • 3,994
  • 21
  • 40
  • Unfortunately this fails with the same error as Method 3. But even if this did work, wouldn't the scripts that require sonLib also have to be run in the same virtual env? – Thomas Matthew Aug 10 '15 at 16:38
  • No, they'd just need to be given the correct path to it. BTW, the error-msg says that a test of sonLib was failing, so I don't think, it's a pip-related issue. If I was you, I'd ask the author of sonLib for help. Its install-instructs look like they need a little improvement: https://github.com/benedictpaten/sonLib/blob/master/doc/INSTALL.txt – Ida Aug 11 '15 at 06:49
  • The author is looking into it. Thanks for your suggestion to use a virtualenv for my python install. – Thomas Matthew Aug 11 '15 at 15:24
  • You're welcome. virtualenv was a real salvation to me, hope it will be for you, too. Good luck with getting libSon going! – Ida Aug 12 '15 at 06:56