0

In short: I am using virtualenv to manage a large amount of requirements but I am concerned that I have conflicting versions of major packages on my Mac.

I have installed both scikit-learn and matplotlib via pip, but my PyCharm won’t acknowledge they exist.

Then I allowed PyCharm (and I tried dozens of times) to “Install requirements” but the error kept coming up when installing matplotlib:

  • The following required packages can not be built:

                    * freetype
    

I’ve tried installing freetype in any ways but it seems to already be here. How do I get passed that error?

From other postings, I learned there is a very noble attempt to get these and many other essential Scientific Python packages installed using the Scipy Superpack for Homebrew

https://github.com/fonnesbeck/ScipySuperpack

I believe this installed correctly but Pycharm still doesn't see it.

Could I be pointing to the original (presumably failed) pip installs when I want to point to the Scipy Superpack?? How do I update my virtualenv to see these packages?

I also found the Anaconda version of Python (which should include matplotlib AND scikit-learn?) and my virtualenv was not pointed to that python executable, but updating that did not help. Do I need to update “which” matplotlib or other packages to point to as well?

I have literally been at this for days and I would throughly appreciate some help. So much in the scientific community of Python requires matplotlib and my research looks like it could really benefit from scikit-learn so any help is greatly appreciated. I realize there are dozens of other posts related to this but the solutions have not resolved my issue. Thank you for any help you can give!

Additional requested info:

python -c "import sys; print sys.path" gave:

['', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-macosx-10.9-intel.egg', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/site-packages/patsy-0.3.0-py2.7.egg', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/site-packages/scipy-0.15.1-py2.7-macosx-10.9-intel.egg', '/[$HOME]/.virtualenvs/JS_dj17/lib/python27.zip', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/plat-darwin', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/plat-mac', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/plat-mac/lib-scriptpackages', '/[$HOME]/.virtualenvs/JS_dj17/Extras/lib/python', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/lib-tk', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/lib-old', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/[$HOME]/.virtualenvs/JS_dj17/lib/python2.7/site-packages']

R Claven
  • 1,160
  • 2
  • 13
  • 27
  • 1
    What python interpreter and PYTHONPATH is your pycharm looking at? https://www.jetbrains.com/pycharm/help/run-debug-configuration-python.html – Joshua Olson Jul 18 '15 at 21:32

1 Answers1

1

Okay, I think I see the problem. You're using system python (on macs you get these issues a lot if you try and use system python, commonly people will use an alternative python), but homebrew installs to /usr/local, so if you do a

brew install pythonX.X

then when you create your virtualenv environment (https://www.jetbrains.com/pycharm/help/creating-virtual-environment.html) select the python out of /usr/local/bin instead and check the inherit global site-packages. That will probably take care of your issues.

Joshua Olson
  • 3,675
  • 3
  • 27
  • 30
  • THIS IS GREAT! But to clarify, I should call homebrew BEFORE I open and start a new virtualenv? and then can I just pip install from a freeze list? – R Claven Jul 18 '15 at 21:51
  • 1
    Actually you shouldn't even need to do that. If you "inherit global site-packages" or setup `--extra-search-dir` (https://virtualenv.pypa.io/en/latest/reference.html#cmdoption--extra-search-dir) you won't need to reinstall them. They'll use the existing installations then you only need to `pip install` the package specific to that project and packages you expect to use frequently can be installed in `/usr/local/...` – Joshua Olson Jul 18 '15 at 21:57
  • Oh dear so I am doing something wrong already: Rs-Mac-mini:~ rpanos$ brew install python2.7 Error: No available formula for python2.7 ==> Searching formulae... ==> Searching taps... Rs-Mac-mini:~ rpanos$ brew install python Warning: python-2.7.10_2 already installed – R Claven Jul 18 '15 at 22:18
  • Sounds like Python is already installed. You just need to select that installation in pycharm for your virtualenv. – Joshua Olson Jul 20 '15 at 02:14