Why does IronPython tell me pip is a package, not an executable?

I am a complete newbie in Python. I wanted to try to see if Pyomo (the Python package for mathematical modeling) can work under IronPython, because all my code for generating the data needed for Pyomo is in C #.

I installed IronPython 2.7.5 and then tried as an administrator the advice found at http://blog.ironpython.net/2014/12/pip-in-ironpython-275.html#disqus_thread on how to run "pip" for IronPython, I used the exact example they gave (setting html5lib ):

ipy -X:Frames -m ensure pip
ipy -X:Frames -m pip install html5lib

The first line worked, and I see in the Lib / site-packages directory a folder with a name pip-6.1.1-py2.7.eggwith a lot of code on it.

In the second line, I got an error:

Unhandled exception:
Traceback (most recent call last):
  File "C:\Program Files (x86)\IronPython 2.7\Lib\runpy.py", line 170, in run_module
  File "C:\Program Files (x86)\IronPython 2.7\Lib\runpy.py", line 111, in _get_module_details
ImportError: No module named urllib; 'pip' is a package and cannot be directly executed

At this moment I am stuck. Any help would be appreciated.

Just in case, this helps, the printout sys.versiongives:

2.7.5 (IronPython 2.7.5 (2.7.5.0) on .NET 4.0.30319.34209 (32-bit))
+4
source share
1 answer

I ran into the same problem. IronPython does not seem to cope with later versions of pip. I have done this:

  • remove all traces from pip and setuptools from the IronPython folder Lib\site-packages
  • run from the command line: ipy.exe -X:Frames -m ensurepip
  • This installed an old pip version that IronPython understands. Verify this by checking Lib/site-packagesthat a folder appears in IronPython
pip-1.5.6.dist-info

Moral of the story; do not update the new version of pip when using IronPython

+4
source

Source: https://habr.com/ru/post/1598042/


All Articles