ARMmbed / yotta_osx_installer

OS X single click yotta application. Makes using yotta on OS X painless
Apache License 2.0
4 stars 4 forks source link

uses system-installed python modules #5

Open autopulated opened 9 years ago

autopulated commented 9 years ago

While the python executable is set to yotta.app/Contents/Resources/workspace/bin/python, if you run python -c "import sys; print sys.path" inside the yotta workspace then you'll still see system python lib directories.

Further, if you look in the contents of:

yotta.app/Contents/Resources/workspace/lib/python2.7

And compare it to your system's python lib dir (probably /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7), you'll notice that most of the standard library is missing.

I believe this is why it seemed like requests[security] is needed even with python >= 2.7.9.

BlackstoneEngineering commented 9 years ago

huh, that's weird, its in a virtualenv, will need to look into that. Think I may have set PATH=YOTTA_PATH:PATH . If you want to take a look at the activate script I would love some help, a wee bit out of my depth as I'm not a usual OSX user.

hrmm, definitely weird, did a standard virtualenv install, wonder why that didn't get pulled in.

PR's welcome!

autopulated commented 9 years ago

So sys.path does include the corresponding virtualenv dirs before the system ones, but because those directories are empty the modules get loaded from the system ones.

I think all that's necessary to fix this is make sure that yotta.app/Contents/Resources/workspace/lib/python2.7 gets the python standard libs included.

BlackstoneEngineering commented 9 years ago

any idea how to do that? I thought it'd be copied across by creating the virtualenv, is there an extra command option at virtualenv creation time i need to run?

autopulated commented 9 years ago

Maybe this helps? http://stackoverflow.com/a/19459977/233201, and possibly this http://stackoverflow.com/a/11301911/233201?

But basically I have no idea – I didn't know virtualenvs could be made portable!

BlackstoneEngineering commented 9 years ago

Need to setup virtualenv using the following commands

virtualenv --system-site-packages <workspace name>

pip install -I <package name>