pycharm 4.0 crosses python interpreter with wrong version of pip

When installing, I chose to import settings from my perfectly working 3.4.? installation.

I could not run pip against python 2.7.8 via the project interpreter settings.  even though I had the correct binary chosen, Pycharm keeps trying to use the pip associated with Python 3.2.  This is sort of weird because I don't have Python 3.2 installed.

In /library/frameworks/python.framework I have python 2.7.8 and python 3.4.1. (Yes, there is the apple version in /system/library/frameworks, which is python 2.7.6 but nothing points there.

I deleted the config from the gear icon and more for 2.7 and attempted to recreate the project interpreter by manually navigating down the the binary file for python in the frameworks..versions..2.7 branch.  I get the interpreter, but PyCharm continues to try to use the wrong pip.  Which is rather weird because the 3.x version should be called pip3.

I must have something funny with my config.  Presumably this would be obvious considering you did a bunch of work on package management for this release.

Got any suggestions?
5 comments
Comment actions Permalink
OK. this is weird.  I had to force quit Pycharm.  When trying to create a new interpreter env, pycharm managed to launch the finder, instead of using its own open dialog.  At this point both pycharm and the finder's open dialog died.  I force quit out of pycharm.

I relaunched pycharm. all of my old interpreters where there again. This time packages installed correctly.

go figure.  Don't know what happened the first time.  

I think pycharm sort of has to settle down and build all of its secret resource tables before it's really ready.
0
Comment actions Permalink
No, sorry. It's a mess.

I know I am getting python 2.7.8 because the python console runs and shows its version:
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

But, for some reason Pycharm is starting pied from a funny directory:
/usr/local/bin/python-32 -u /Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py 52969 52970

That python-32 is naturally a symlink to another symlink in /Library/Frameworks/Python.framework/versions/2.7/bin   – so at least we are getting back to the right place, sort of.   

The next "original" is a file called python2-32 which is a symlink to python2.7-32, which is the 32 bit executable for python 2.7.  OK, that makes sense.

Somehow, this should show Pycharm where to find the corresponding pip.  Indeed, in that same bin directory there is pip, which is binary executable (probably just a stub loader because it is teeny) for pip.  Indeed, if I launch a terminal in this directory and run pip I get pip 1.5.6 for python 2.7.

So, everything seems to lead to the right place.

The error message is:

OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/__init__.py'  when I try to update ipython.

The command output is:

DEPRECATION: –no-install, –no-download, –build, and –no-clean are deprecated.  See https://github.com/pypa/pip/issues/906.
Downloading/unpacking ipython from https://pypi.python.org/packages/2.7/i/ipython/ipython-2.3.1-py27-none-any.whl#md5=14b9c7c5280ded28777559c434947573
Requirement already up-to-date: gnureadline in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from ipython)
Installing collected packages: ipython
  Found existing installation: ipython 2.2.0
    Uninstalling ipython:
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1431, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 598, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1836, in remove
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/util.py", line 295, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/__init__.py'

Storing debug log for failure in /Users/lewislevin/.pip/pip.log

2.2.0 is installed and 2.3.1 is the new version.  So, pycharm must be running pip with its own requirements file to find the versions for everything.

OK, one more step.  Let's just see if it is a permissions problem.  Which is weird because Python 3.4.x was happy.
0
Comment actions Permalink
Peeling back some more.

The owner of site-packages is root which means we can't really do anything without running sudo or its Mac OS X equivalent.  That seems weird, but still Pycharm 3.4 was happy with those privileges. Generally, when you legitimately try to change a root folder on the mac, you get the permission prompt (GUI sudo, I guess).

But, Pycharm 3.4 never generated the system permission prompt.

Here is what I think might be happening.  Since the last time I did any package management with Pycharm 3.4, I upgraded to Yosemite, os x 10.10.1.  I'll bet the upgrade makes everything super secure.

Next step:  let's see if pip works from terminal.
0
Comment actions Permalink
Well, that was easy.  pip failed with same command output.  Of course it did.  All Pycharm does is run pip.

sudo pip install ipython -U naturally worked.

So, how do I get pycharm to use sudo?

Or can I change the owner of the python framework to myself?  

Anyone have any idea how it got to be root? is this normal?
0
Comment actions Permalink
Well, my first theory was quite wrong, but I traced it through.

I changed the owner to myself and it all works.

Curious thing is why did I have to when I didn't before.  

Theory:  Yosemite helped me by changing the owner to root to protect me.
0

Please sign in to leave a comment.