how to get spyders python recognize external packages on MacOS X?

2024/11/19 3:23:15

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

Answer

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.

https://en.xdnf.cn/q/70983.html

Related Q&A

textcat - architecture extra fields not permitted

Ive been trying to practise what Ive learned from this tutorial:(https://realpython.com/sentiment-analysis-python/) using PyCharm. And this line: textcat.add_label("pos")generated a warning: …

cv2.rectangle() calls overloaded method, although I give other parameter

cv2.rectangle has two ways of calling:img = cv.rectangle( img, pt1, pt2, color[, thickness[, lineType[, shift]]] ) img = cv.rectangle( img, rec, color[, thickness[, lineType[, shift]]]source:h…

Converting xls to csv in Python 3 using xlrd

Im using Python 3.3 with xlrd and csv modules to convert an xls file to csv. This is my code:import xlrd import csvdef csv_from_excel():wb = xlrd.open_workbook(MySpreadsheet.xls)sh = wb.sheet_by_name(S…

HTMLParser.HTMLParser().unescape() doesnt work

I would like to convert HTML entities back to its human readable format, e.g. £ to £, ° to etc.Ive read several posts regarding this question Converting html source content into read…

What security issues need to be addressed when working with Google App Engine?

Ive been considering using Google App Engine for a few hobby projects. While they wont be handling any sensitive data, Id still like to make them relatively secure for a number of reasons, like learnin…

Supporting multiple Python module versions (with the same version of Python)

I looked around but cannot find a clear answer to my question.I have a very legitimate need for supporting N-versions of the same Python module.If they are stored in the same same package/directory, th…

ImportError: cannot import name signals

Im using Django 1.3.0 with Python 2.7.1. In every test I write the following imports I get the importError above:from django.utils import unittest from django.test.client import ClientThe full stack tr…

Return a Pandas DataFrame as a data_table from a callback with Plotly Dash for Python

I would like to read a .csv file and return a groupby function as a callback to be displayed as a simple data table with "dash_table" library. @Lawliets helpful answer shows how to do that wi…

Nose: How to skip tests by default?

I am using Pythons nose and I have marked some of my tests as "slow", as explained in the attrib plugin documentation.I would like to skip all "slow" Tests by default when running n…

SQLAlchemy ORM select multiple entities from subquery

I need to query multiple entities, something like session.query(Entity1, Entity2), only from a subquery rather than directly from the tables. The docs have something about selecting one entity from a s…