Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtualenv procedure in Readme file #26

Closed
alemangui opened this issue Sep 26, 2015 · 4 comments
Closed

virtualenv procedure in Readme file #26

alemangui opened this issue Sep 26, 2015 · 4 comments

Comments

@alemangui
Copy link

Hello,

Perhaps using virtualenv for the installation would be better since it creates an environment that is segregated from the system wide installations. It would also be the same procedure for Mac OS X.

I can gladly work on a PR to update the README file, would that be of interest?

@odub
Copy link

odub commented Nov 19, 2015

I've just been trying to set the repo up in a virtualenv on OS X. Particularly there seem to be some fragile corners around setting up matplotlib. Documentation would be useful if you're willing!

Thanks.

@odub
Copy link

odub commented Nov 19, 2015

Oh, a way I found around the matplotlib issue described in that link was to install a 1.4 version.

So within the virtual env:
pip install 'matplotlib<1.5.0'

Maybe there's a neater way of using 1.5 but as a temporary solution this works for me.

@tardate
Copy link

tardate commented Oct 1, 2016

good idea. here are my notes, happy to contribute a PR or have someone steal this into theirs..

Running sms-tools with virtualenv

(this works particularly well for MacOSX users)

Let's assume you aready have virtualenv installed. The purpose of virtualenv is to isolate software installations to their own "virtual environment", which can help avoid dependency conflicts and environment-related bugs.

It seems (so far) the sms-tools run quite happily with virtualenv.

However, special considerations are required due to restrictions of the matplotlib library used in the python code - see Working with Matplotlib in Virtual environments.

The simplest technique that seems to work, is to not activate the virtual environment while using sms-tools, but instead point the PYTHONHOME path to the virtual environment folder.

Setup - PYTHONHOME approach

First, choose a place to create the virtualenv folder. One level above the sms-tools folder is a good idea, and venv is as good a name as any.

Create the venv folder, activate it and make sure it has an up-to-date pip installed (not required, but generally a good idea):

$ virtualenv venv
$ source venv/bin/activate
(venv)$ pip install --upgrade pip
(venv)$ deactivate

Note the critical step: deactivate the virtualenv.

Instead, set the PYTHONHOME environment variable to point to venv (absolute path)

$ export PYTHONHOME=$(cd venv; pwd)
# or set it explicitly:
$ export PYTHONHOME=/some/path/to/venv

Install the sms-tools dependencies (currently there is no requirements.txt for this), and compile the utilFunctions_C:

$ pip install ipython numpy matplotlib scipy cython
$ cd $PYTHONHOME/../sms-tools/software/models/utilFunctions_C
$ python compileModule.py build_ext --inplace 

Now test it out with models_GUI.py.

First you will need to apply a minor edit for models_GUI.py using this fix for Matplotlib crashing on Mac OS X

$ cd $PYTHONHOME/../sms-tools/software/models_interface
$ python models_GUI.py

.. and the sms-tools models GUI should pop up and be fully functional.

tardate added a commit to tardate/sms-tools that referenced this issue Oct 1, 2016
tardate added a commit to tardate/sms-tools that referenced this issue Oct 1, 2016
@xserra
Copy link
Member

xserra commented May 8, 2017

this is not an sms-tools problem, closing.

@xserra xserra closed this as completed May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants