Code Monkey home page Code Monkey logo

Comments (4)

tardate avatar tardate commented on August 23, 2024 2

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.

from sms-tools.

odub avatar odub commented on August 23, 2024

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.

from sms-tools.

odub avatar odub commented on August 23, 2024

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.

from sms-tools.

xserra avatar xserra commented on August 23, 2024

this is not an sms-tools problem, closing.

from sms-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.