IronLanguages / ironpython2

Implementation of the Python programming language for .NET Framework; built on top of the Dynamic Language Runtime (DLR).
http://ironpython.net
Apache License 2.0
1.07k stars 229 forks source link

How do I install pip on ubuntu? #364

Open tzachshabtay opened 6 years ago

tzachshabtay commented 6 years ago

Hi, downloaded the zip file from release 2.7.8. I'm trying to install pip for IronPython on ubuntu 16.04 LTS 64 bits.

Tried the dotnet core runtime first with bash netcoreapp2.0/ipy.sh -X Frames -m ensurepip and got:

Unhandled exception:
Traceback (most recent call last):
  File "/home/tshabtay/Downloads/IronPython/Lib/runpy.py", line 187, in run_module
  File "/home/tshabtay/Downloads/IronPython/Lib/runpy.py", line 81, in _run_module_code
  File "/home/tshabtay/Downloads/IronPython/Lib/runpy.py", line 72, in _run_code
  File "/home/tshabtay/Downloads/IronPython/Lib/ensurepip/__main__.py", line 4, in <module>
  File "/home/tshabtay/Downloads/IronPython/Lib/ensurepip/__init__.py", line 231, in _main
  File "/home/tshabtay/Downloads/IronPython/Lib/ensurepip/__init__.py", line 127, in bootstrap
  File "/home/tshabtay/Downloads/IronPython/Lib/ensurepip/__init__.py", line 47, in _run_pip
  File "/tmp/tmpWUMHbt/pip-8.1.1-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
  File "/tmp/tmpWUMHbt/pip-8.1.1-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
  File "/tmp/tmpWUMHbt/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
  File "/tmp/tmpWUMHbt/pip-8.1.1-py2.py3-none-any.whl/pip/wheel.py", line 32, in <module>
  File "/tmp/tmpWUMHbt/pip-8.1.1-py2.py3-none-any.whl/pip/pep425tags.py", line 9, in <module>
  File "/home/tshabtay/Downloads/IronPython/Lib/ctypes/__init__.py", line 7, in <module>
ImportError: No module named _ctypes

That's after I've set IRONPYTHONPATH to point at Lib.

Then I tried mono with net40 with mono net40/ipy.exe -X Frames -m ensurepip and got:

Unhandled exception:
Traceback (most recent call last):
TypeError: Value cannot be null.
Parameter name: method

Finally I tried mono with net45 with mono net44/ipy.exe -X Frames -m ensurepip and got:

Traceback (most recent call last):
  File "/home/tshabtay/Downloads/IronPython/Lib/logging/__init__.py", line 861, in emit
    msg = self.format(record)
  File "/tmp/tmpREzdTo/pip-8.1.1-py2.py3-none-any.whl/pip/utils/logging.py", line 108, in format
    if self.should_color():
  File "/tmp/tmpREzdTo/pip-8.1.1-py2.py3-none-any.whl/pip/utils/logging.py", line 95, in should_color
    if hasattr(real_stream, "isatty") and real_stream.isatty():
SystemError: GetStdHandle
Logged from file basecommand.py, line 1

Can any of those be made to work? Thanks.

slide commented 6 years ago

This has not been tested at all, so you are breaking new ground. The net45 is a known issue (I think there is already an issue filed for it). net40 is going to be removed soon, so don't spend any time on that. For the .NET Core, it looks like _ctypes is required, I thought we had that for .NET Core though, so I don't know why its failing like that.

slozier commented 6 years ago

@slide No support for ctypes on .NET Core at the moment. I don't remember what was the blocking factor...

slide commented 6 years ago

@slozier did some nice work in #365 to get ctypes working with .net core.

slozier commented 6 years ago

I tried with the latest bits and am still getting some issues. With Mono:

Exception:
Traceback (most recent call last):
  File "/tmp/tmplrCmUX/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/tmp/tmplrCmUX/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 313, in run
    requirement_set.install(
  File "/mnt/c/IronPython.2.7.9-candidate1/Lib/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/tmp/tmplrCmUX/pip-8.1.1-py2.py3-none-any.whl/pip/utils/logging.py", line 36, in indent_log
    yield
Error: `/mnt/c/IronPython.2.7.9-candidate1/lib/python2.7/site-packages/setuptools-20.10.1.dist-info/RECORD.pip` and `/mnt/c/IronPython.2.7.9-candidate1/lib/python2.7/site-packages/setuptools-20.10.1.dist-info/RECORD` are the same file

With .NET Core it works the first time around, however the files are ending up in an odd location: /mnt/c/IronPython.2.7.9-candidate1/Lib/python2.7/site-packages. Also, if I try to install again I get an error:

Traceback (most recent call last):
  File "/tmp/tmpXMmD4P/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/tmp/tmpXMmD4P/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 313, in run
    requirement_set.install(
  File "/mnt/c/IronPython.2.7.9-candidate1/Lib/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/tmp/tmpXMmD4P/pip-8.1.1-py2.py3-none-any.whl/pip/utils/logging.py", line 36, in indent_log
    yield
Error: `/tmp/pip-build-OBEpFJ/setuptools/easy_install.py` and `/mnt/c/IronPython.2.7.9-candidate1/lib/python2.7/site-packages/easy_install.py` are the same file
slozier commented 6 years ago

The exceptions above have been resolved, however there are more issues to figure out, for example:

slozier commented 6 years ago

Looks like the install folder is from in setuptools (easy_install.py):

    INSTALL_SCHEMES = dict(
        posix=dict(
            install_dir='$base/lib/python$py_version_short/site-packages',
            script_dir='$base/bin',
        ),
    )
tarlano commented 6 years ago

Is there any update on closing this issue?

It looks as if this is the only issue holding up the 2.7.9 release.

https://github.com/IronLanguages/ironpython2/milestone/1

slide commented 6 years ago

There is still a fair amount of work that needs to be done here, I think we might remove this from the 2.7.9 milestone.

slozier commented 6 years ago

I think it was somewhat working with the latest bits (at least the Mono version). I will have to try it again to double check.