1

I am using a Jython virtualenv where I can install whatever software via pip or via easy_install, but there is a software that is not registered yet and the installation mode via:

[sudo] python setup.py install 

and I am trying to do the same with jython:

[sudo] jython setup.py install

So, I am getting these follow errors:

Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools

I checked and installed jython ez_setup.py again. I downloaded the yolk and didn't solved too.

My folder:

╭─hudson@hudson-pc ~/jython2.7a1/Lib/site-packages ‹› ‹master*›
╰─$ ls 
easy-install.pth         setuptools.pth yolk 0.4.3-py2.7.egg README should_dsl-2.0a5-py2.7.egg setuptools-0.6c11-py2.7.egg virtualenv-1.7.2-py2.7.egg 

And at the normal(real) environment, without virtualenvs, I got the same erros.

At Python I already installed this software and worked well.

If I enter at Jython Shell and try import setuptools, I got the same erros too:

>>> import setuptools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named setuptools
>>> import sys
>>> sys.path
['', '/home/hudson/jython2.7a1/Lib', '/home/hudson/__classpath__',   '/home/hudson/__pyclasspath__']

Then, I add the site-packages to the sys (It can be a stupid attempt):

>>> sys.path.append('/home/hudson/jython2.7a1/Lib/site-packages')    
>>> sys.path
['', '/home/hudson/jython2.7a1/Lib', '/home/hudson/__classpath__', '/home/hudson/__pyclasspath__', '/home/hudson/jython2.7a1/Lib/site-packages']  
>>> import setuptools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named setuptools

Why is not recognizing?

Joel
  • 4,732
  • 9
  • 39
  • 54
hudsonsferreira
  • 207
  • 2
  • 13

2 Answers2

2

If pip "works" then you could use it to install your software. To try it, run from a directory with setup.py:

$ pip install -e .

If you have a tarball of the package:

$ pip install your_package-0.0.1.tar.gz

pip can install from a git repository, use custom urls from where to get packages, etc.

I've tested it: jython works with virtualenv, distribute (a fork of setuptools), pip. So jython can install a package if it uses setuptools in setup.py.

sschuberth
  • 28,386
  • 6
  • 101
  • 146
jfs
  • 399,953
  • 195
  • 994
  • 1,670
  • I runned pip install -e . and worked well. I didn't know this param. Thank you very much! – hudsonsferreira Aug 01 '12 at 19:42
  • `pip install -e` runs `python setup.py develop` not `python setup.py install` so it's not equivalent of the latter. – Piotr Dobrogost Feb 19 '13 at 10:53
  • How how does jython work with distribute or setuptools? – Thufir Jan 16 '17 at 17:41
  • @Thufir I don't understand your question. What do you mean by "how"? Note: many-many versions have been released since 2012 — I don't know how whether the latest pip/setuptools/virtualenv versions are compatible with jython. – jfs Jan 16 '17 at 19:15
1

Basically you need to install the installtool first. To do so see the doc linked below.

install this: http://peak.telecommunity.com/dist/ez_setup.py

(see here:http://www.jython.org/jythonbook/en/1.0/appendixA.html#setuptools)

ted
  • 4,791
  • 5
  • 38
  • 84
  • As you can see at my first line explanation I already did it and via easy_install or via pip works, but I need to install a software that is not registered yet. – hudsonsferreira Jul 31 '12 at 16:30
  • Make sure you did `jython ez_setup.py`. What is in your `/Lib/SitePackages` directory? i don't have jython here but if i get a chance iw ill tell you were easy install should be, since the error message clearly states that `setuptools` is missing – ted Jul 31 '12 at 22:33
  • Maybe you can obtain a listing of packages with the `yolk` package (see package index) – ted Jul 31 '12 at 22:40
  • You can try import setuptools on your console and check that setuptools is in `sys.path`. In my basic installation setuptools lives as `setuptoolsXXX.egg` under `/Lib/SitePackages` I am not quite sure if virtualenv should copy this on creation or simply runs it from the base. A further thing you could try is to install the package from your real enviornment with the `--user` flag to see if that works – ted Aug 01 '12 at 09:40
  • First of all, thanks for your attention. I checked and installed **jython ez_setup.py** again. I downloaded the yolk and didnt solved too. At my folder **jython/lib/SitePackages**: **╭─hudson@hudson-pc ~/jython2.7a1/Lib/site-packages ‹› ‹master*› ╰─$ ls easy-install.pth setuptools.pth yolk 0.4.3-py2.7.egg README should_dsl-2.0a5-py2.7.egg setuptools-0.6c11-py2.7.egg virtualenv-1.7.2-py2.7.egg** And at the normal(real) environment I got the same erros. At Python I already installed this software and works. – hudsonsferreira Aug 01 '12 at 14:00
  • what about trying `import setuptools` on a jython shell? Can you give information about the package, atleast the first three lines (error at line three)? And if you don't mind, just add your information to your initial question, that way it is much easier to read, just give me a first note in the comments so I get a notice that you updated. I hope that this can be solved before tomorrow, after that I am gone for a week. And if the import on the shell fails can you print the `sys.path`? – ted Aug 01 '12 at 18:02