Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get spyder's python recognize external packages on MacOS X?

I have spyderlib installed on my MacOS X (10.6.8) using the official dmg file. In parallel, I have installed packages using both pip and homebrew from the terminal (i.e. opencv, gdal...). As Spyder is using its own python version, I cannot access my external packages within Spyder.

When Homebrew install a package, it instals it in the /usr/local/lib... directory, which is not avalaible to add using the Python Path manager of Spyder.The entire directory /usr/... is hidden.

The only relevant similar case I found online was the following: Adding a module (Specifically pymorph) to Spyder (Python IDE)

I have tried unsuccessfuly their recommendations. So two related questions to tackle the problem:

1- would it be possible to actually use in Spyder the same python as the one accessed in the terminal?

2- otherwise, how to add external packages to the Spyder's original python, when the packages are installed in the folder /usr/local... ?

Thanks

like image 715
Simon Avatar asked Mar 18 '14 23:03

Simon


People also ask

How do I check Python packages on Mac?

From the Python REPL (the command-line interpreter / Read-Eval-Print-Loop), type help("modules") to see a list of all your available libs.


1 Answers

I don't use a mac, but I would go with option 1, building and installing Spyder on your regular Python. Install PyQt4 if you don't have it:
brew install pyqt
Then download the Spyder 2.2.5 source (spyder-2.2.5.zip) from here, unzip the folder where you like. Then open a terminal, and go inside the Spyder source folder (you must input the next commands from inside this folder). Then build using your regular python executable:
python setup.py build
and install:
python setup.py install

If all dependencies are met, you should then have Spyder as a package under your main Python installation. There should be a script to execute it under the Scripts folder.

You can also see "Install or run directly from source" from the main Spyder installation page.

like image 196
Roberto Avatar answered Sep 29 '22 19:09

Roberto