Upcoming Meets

With rare exception PythonTrier meets on the second Tuesday of every month at:

Maschinendeck Hackerspace
Eurener Str. 14
54294 Trier.

Upcoming events are scheduled on:

Speakers needed

Looking for those that could share their knowledge about and experience with Python.
If you have a favourite package, pet project, or topic that you could present during a meet, then please consider
sharing with a lightning talk or full presentation. The choice is yours!

Group Resources

There is a GitHub account for the group which can be located at:
https://github.com/PythonTrier
Presentations and group projects will all be kept here.

The group also has a slack account where people can communicate directly
about meetings, challenges, or anything else in general. The group is
https://PythonTrier.slack.com.
Just set up an account and join the group. There are apps available for Android, iPhone, as well as a web App that
can be used on most browsers.

Conferences

Up and Running with Virtual Environments, Part II

Apr 26, 2017

One of the problems I encountered working with Brew, was how to select which versions of Python are used when I
installed a virtual environment. You can check which versions you currently have on your system by executing
brew info <desired forumla>. As you can see in my example, I have 3.5.1, 3.5.2, 3.6.0, and 3.6.1 on my system. You
will also notice that version 3.6.1 is starred as the currently selected version.

Using mkvirtualenv <env name> will install the starred version. But what if I’m working on a project that uses an
older version of Python? If you have the version that you want in your cellar, then you can use
brew switch <formula> <version>.

The problem you may run into is when you want a version that existed prior to when you installed Python with Brew. The
repository for previous formula versions has been deprecated, which has led to several articles and StackOverflow
questions on how to fill this void.

So if you can’t use brew switch, then you can expand your options using pyenv. Installing is easy with Brew.
brew install pyenv. Once you’ve installed pyenv, you can check which versions are available by using
pyenv install --list. The list of options is quite extensive. It includes versions of Python 2, Python 3,
Anaconda, Anaconda 2 & 3, ironpython, jython, miniconda, miniconda 2 & 3, pypy, pyston, and stackless python.

Note: As of the posting of this article, I received errors for Python versions 3.1 and 3.2. Support was deprecated
by virtualenv for certain versions. If you receive something like
OSError: Command /Users/Steglitz/Envs... - setuptools pip wheel failed with error code 1, then you may have been
trying to install an unsupported version. Just something to be aware of.

Also important to note is that you need your pyenv directory to be before /usr/local/bin in your path. You can
configure that in your .rc file by adding the following exports.

By default, pyenv saves each version of Python in ~/.pyenv/ I want my virtualenvs to be stored in the same
neighborhood with my homebrew, so I’ve set my PYENV_ROOT to /usr/local/var/pyenv. This is where it will
store all of my Python versions. Now everything will be installed in a nice, easy to find, spot. Now it’s a matter of
installing the version you want. So now let’s install Python 3.3.0.

You may also note that installing does not change the global version. You can change that with pyenv global 3.3.0.
Now when you check the versions again, you’ll see that it has updated the global version.

You can see that after activating, the test330 environment’s ‘bin’ directory was placed at the beginning of the
$PATH. As a result, the virtual env’s directory will be the first directory searched, and you end up using the
virtual env Python instead of the system Python. This should also be a consideration when you have more than one virtual
env activated. It is possible that running more than one version at a time could create conflicts between environments.
So keep it simple, keep it separate, and everything should be good.