1

I am attempting to install a package for python3.4 on Mac OSX 10.9.4. As you know, python ships with OSX, so when I installed python3.4 I was happy to find that it came with its own version of pip, that would install packages to it (installing pip on a mac with multiple versions of python will cause it to install on the system's python2.7.)

I had previously tried installing this package (https://pypi.python.org/pypi/chrome/0.0.1) with my first installation of pip (the one tied to python2.7) and found that it successfully installed on that version, but not on any others.

I ran an install with the new pip keyword for python3.4 (which when called by itself spits out the help page so i know it works) and it told me that the package was already installed and to try updating. The update revealed that I already had the most recent version. so I tried uninstalling it from just the python3.4 and reinstalling to no avail, and got the same results when uninstalling pip from python2.7 and reinstalling only on version 3.4.

I know that's a bit hard to follow but hopefully that makes sense.

I also reviewed the content here with no success.

RESOLVED:

while python did have a directory named the same as a directory it uses with packages, this was not the correct directory, for me it was in a subdirectory of library. while documentation said that referencing pip2 would cause the package to install on python3.4, this was false. however, referencing pip3.4 worked for me.

Community
  • 1
  • 1
  • You should look into virtualenv and virtualenvwrapper. – geekofalltrades Aug 21 '14 at 15:51
  • Why do you care if the python2.7 version has the package installed too? if it was already installed, why try and uninstall-reinstall? What's the problem? – yuvi Aug 21 '14 at 15:52
  • the problem isn't that it is installed on 2.7, it's that it isn't on 3.4. i've been working with virtualenv (per the awnser) but so far it hasn't been working. – LukasMetlicka Aug 21 '14 at 17:21

1 Answers1

1

My suggestion is that you start using virtualenv.

Assuming you have 3.4 installed, then you should also have pyvenv. As for pip and 3.4, it should already be installed.

Using for example version 3.4 create your own virtual environment and activate it:

$ mkdir ~/venv
$ pyvenv-3.4 ~/venv/py34
$ source ~/venv/py34/bin/activate
$ deactive                     # does what is says...
$ source ~/venv/py34/bin/activate
$ pip install ...  # whatever package you need

With version 2.7 first install virtualenv and then create your own virtual environment and activate it. Make sure that setuptools and pip are updated:

$ virtualenv-2.7 ~/venv/venv27
$ . ~/venv/venv27/bin/activate
$ pip install -U setuptools
$ pip install -U pip
$ pip install ...  # whatever package you need
FredrikHedman
  • 1,223
  • 7
  • 14
  • do I need to virtualenv python2.7 to be able to install the package on 3.4? because I set up the virtualenv for python3.4 and installed the package, but it still doesn't recognize the package on import. (I tried both pip keywords as well) – LukasMetlicka Aug 21 '14 at 17:07
  • Activating a particular virtualenv will set up an environment that is more or less independent of other environments and the system wide installation. You do not need any 2.7 stuff to run your 3.4 stuff. Can you give the full command sequence from activation to installation and package import to demonstrate your problem? – FredrikHedman Aug 21 '14 at 18:15
  • sure. I started by following your instructions on making a virtualenv for python3.4. it went without a hitch, and I was able to pip install the package. everything was going well until i loaded the python interpreter and tried to import the package, which it didn't recognize. I did some googling to make sure I had virtualenv set up, and followed [this](http://docs.python-guide.org/en/latest/dev/virtualenvs/) guide to set up virtualenv. I installed it on both versions of python, to no avail. – LukasMetlicka Aug 21 '14 at 18:30
  • As for chrome it does not install cleanly for 3.4. I get an import error for the module "application": ImportError: No module named 'application'. – FredrikHedman Aug 21 '14 at 18:31
  • I get the same error. any way around this? Or am I stuck? – LukasMetlicka Aug 21 '14 at 18:51
  • Looking at the code of 'application' and 'chrome', the __init__.py files appears broken in a different ways. No need to import, and a naming a new class list is not a good idea. But this is really off-topic. Monkey patching might work, but the code and packaging seems to need some serious work to get it working. – FredrikHedman Aug 21 '14 at 19:15
  • Digging a bit further, I can get parts of the example running after some patching, but most parts of the example just generates one error after the other. Need serious work by package owner and is off-topic in this post. – FredrikHedman Aug 21 '14 at 19:41
  • I tried looking for another package but came up empty-handed. the best I could find was a package that was windows exclusive, [cefpython.](https://code.google.com/p/cefpython/) But this is useless to me as they don't have a mac or linux version. – LukasMetlicka Aug 21 '14 at 20:21
  • Followup: I have discovered that pip did it's job correctly. the package's library is in the correct directory, it just isn't recognized by IDLE. the path browser shows this as one of the directories it will use to look for packages, but it doesn't recognize the package regardless. Any ideas? – LukasMetlicka Aug 25 '14 at 18:10
  • Because the code in the module chrome-0.0.1 is wrong. It can be fixed, but require some work. In addition, it seems to be orphaned since its home page returns a 404. What is that you want to do when using this pack? – FredrikHedman Aug 25 '14 at 21:28
  • I want to be able to get the url of the active page, as well as detect its scroll position so that I can translate that to other browsers simultaneously. – LukasMetlicka Aug 26 '14 at 13:14