6

I'd like to add the PRAW package to an IronPython solution in VS however it's proving to be a pain in the butt. Here are steps I'm taking

  • right-click on IronPython Environment, select install python package.
  • type in "Praw" using pip
  • I get a prompt telling me that pip needs to get installed.

I then see the following:

Installing 'pip' package manager.
Downloading distribute from https://go.microsoft.com/fwlink/?LinkID=306663
Installing from distribute-0.6.45
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at c:\program files (x86)\ironpython 2.7\lib\site-packages\setuptools-0.6c11-py2.7.egg
Egg installation
Already patched.
running install
Traceback (most recent call last):
  File "setup.py", line 147, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\core.py", line 151, in setup
  File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 952, in run_commands
  File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 971, in run_command
  File "c:\users\mj\appdata\local\temp\ptvs-9jvsvw-pip_downloader\distribute-0.6.45\setuptools\command\install.py", line 63, in run
AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\pip_downloader.py", line 47, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\subprocess.py", line 512, in check_call
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\IronPython 2.7\\ipy64.exe', 'setup.py', 'install']' returned non-zero exit status 1
'pip' failed to install. Exit code: 1

With the reason for the failed install being: AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):

How do I get around this? Is there a way to install pip and for ironpython in a different manner? Is there a way to install packages/libraries by not having to use pip? I can install the package just fine via Pip for python 2.7.

Pavel Minaev
  • 99,783
  • 25
  • 219
  • 289
MickJuice
  • 539
  • 2
  • 10
  • 25

1 Answers1

3

You have to run IronPython with the command line option -X:FullFrames. I'm not sure, though, how to set that up in the VS.

Maybe you can manually run it:

C:\path\to\ipy64.exe -X:FullFrames path\to\pip.py install whaterver_you_want
Viktor Kerkez
  • 45,070
  • 12
  • 104
  • 85
  • 2
    I still get the "object has no attribute '_getframe' – MickJuice Aug 25 '13 at 23:50
  • 2
    It seems that installing packages works only for CPython environments. I looked at their code and it seems that they have their own version of pip and distribute, but apparently it still doesn't work with IronPython. Maybe you should create an issue on their website. – Viktor Kerkez Aug 26 '13 at 07:51
  • Thanks Viktor. I've decided I'm going to use regular python and not bother with IronPython for now. The main reason for IP was I wanted to use .Net dlls as I'm more familiar with them but after some thought, using python libraries will get me out of my comfort zone and allow me to learn more. I appreciate your help. – MickJuice Aug 27 '13 at 15:10
  • 1
    PTVS does _not_ have its own version of pip and distribute - it downloads and installs the stock packages. – Pavel Minaev Sep 16 '13 at 19:21
  • 1
    @PavelMinaev [pip_downloader.py](https://pytools.codeplex.com/SourceControl/latest#Python/Product/PythonTools/pip_downloader.py) All links to pip start with _https://go.microsoft.com/..._ so I assumed that it's not a stock package... But now I see that they are just forward links... My mistake. – Viktor Kerkez Sep 16 '13 at 19:38
  • 1
    FWIW, I've tried getting setuptools to install on IronPython 2.7.4, and it doesn't work even with -X:FullFrames. It seems that it's still not supported. PTVS does not block you from trying on the basis that some future version of IronPython might add the missing pieces. – Pavel Minaev Sep 16 '13 at 20:44