2

I've read several article but I've had no luck as my situation conflicts with one or more freedoms that others have. This is my situation.

  • I've no access to root.
  • I'm just a user with access to python. No sudo.
  • python 2.x.x is pre-installed
  • pip is not pre-installed.
  • apt-get requires root privileges.

My goal is to install a simple module called Guessit from Github for my foo.py project. The installation for it is given by pip so that option is ruled out. I tried to manually install as per https://github.com/guessit-io/guessit/blob/master/docs/sources.rst. I downloaded the zip file, extracted it and ran

python setup.py install

It gives me the following error

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

So, at this point I reckoned I needed setuptools module and hence downloaded https://bootstrap.pypa.io/ez_setup.py and tried to install it as per https://pypi.python.org/pypi/setuptools by running

wget https://bootstrap.pypa.io/ez_setup.py -O - | python

Again, it was a failure with an error like this:

Downloading https://pypi.io/packages/source/s/setuptools/setuptools-24.0.0.zip
Extracting in /tmp/tmplNW7fe
Now working in /tmp/tmplNW7fe/setuptools-24.0.0
Installing Setuptools
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    exec(init_file.read(), command_ns)
  File "<string>", line 11, in <module>
  File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/__init__.py", line 14, in <module>
    from setuptools.extension import Extension
  File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/extension.py", line 11, in <module>
    from . import msvc
  File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/msvc.py", line 244, in <module>
    class PlatformInfo:
  File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/msvc.py", line 253, in PlatformInfo
    current_cpu = safe_env['processor_architecture'].lower()
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'processor_architecture'
Something went wrong during the installation.
See the error message above.

Now, I'm guessing there is a match problem with the architecture of that setup and on my machine.

At this point, I'm not even sure if what I'm doing is right anymore. For whatever its worth, this is my the computer achitecture using uname -a

Linux sl04.cmi.ac.in 3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:41 UTC 2016 i686 i686 i686 GNU/Linux

Any help would be greatly appreciated!

  • It might be a little drastic, but given how tangled up you're getting, it might be the easiest way out: Install a minimal "anaconda scientific python" distribution (i.e. no packages, just the package manager and a minimal environment). It doesn't require root access and it comes with all the goodies like `pip`. – alexis Jul 02 '16 at 19:52
  • That is way off the track~ –  Jul 02 '16 at 20:06
  • You can build the latest Python from source. – notorious.no Jul 02 '16 at 20:10
  • Isn't that a bit of an overkill too? –  Jul 02 '16 at 20:18
  • I think @notorious is making fun of my suggestion. I agree, it's a pretty blunt solution (that's why it's a comment, not an answer). But if you're failing to even install an installer, you have your work cut out for you. – alexis Jul 02 '16 at 20:48
  • Try `get-pip.py --user` https://pip.pypa.io/en/stable/installing/ – Klaus D. Jul 02 '16 at 21:35
  • `wget https://bootstrap.pypa.io/ez_setup.py -O - | python - --user` – Corey Goldberg Jul 02 '16 at 21:49
  • What exactly is the version of Python you have? – edwinksl Jul 02 '16 at 21:55

2 Answers2

2

There's a problem in setuptools 24.0.0 (released today). I assume it will be fixed soon. Meanwhile, downgrade to 23.1 and reinstall the desired package.

itzhaki
  • 822
  • 2
  • 7
  • 19
1

from your description it sounds like you could install setuptools in a user-local path to get over your first hurdle.

see: https://pypi.python.org/pypi/setuptools#installation-instructions


but really in a situation like the OP, you would bootstrap pip:

then:

  • pip install virtualenv

then use an activated virtualenv as a place to install your module.

This would keep your module or other dependencies apart from system packages, and doesn't require special privleges.

Corey Goldberg
  • 59,062
  • 28
  • 129
  • 143
  • Be careful with this - you're replacing the system version of the package with your own. Now you're assuming all responsibility for maintaining it! – Xiong Chiamiov Jul 08 '16 at 00:24
  • @XiongChiamiov, not replacing it, but shadowing it locally. I updated my answer with better explanation. – Corey Goldberg Jul 14 '16 at 02:09