How to create a Python virtual environment for OpenBazaar

You may run into errors when running OpenBazaar-Server. One common error is this:

Traceback (most recent call last):
 File "", line 8, in <module>
   import stun
ImportError: No module named stun

This happens because Python (which is running OpenBazaar-Server) doesn’t have access to the Python module, stun. If you have already run the command, pip install -r requirements.txt, but you’re still seeing the above error, try creating a python virtual environment for your OpenBazaar-Server to run in.

If you are working with a new VPS, you likely don’t have virtualenv installed. It’s easy to do so, using apt-get–

$ sudo apt-get install python-virtualenv

Once you have virtualenv installed, the first step is to create the virtual environment for your OpenBazaar-Server. We will call our new virtual environment, ob. This needs to be run in the same directory as

$ virtualenv ob

now our virtual environment is created. You will notice that there is a new folder in this directory called ob.

Next step is to enter the virtual environment. We do that by sourcing a bash script called activate.

$ source ob/bin/activate

Now we are in the virtual environment. We can tell this because the start of our bash prompt now shows (ob)$

Next step is to install python dependencies inside this virtual environment. We do that using pip. Even if you’re run this command previously, you need to run it again, because the dependencies inside the virtual environment are not the same as the dependencies outside the virtual environment–

$ pip install -r requirements.txt

Our dependencies are installed, and we can now run OpenBazaar-Server inside this virtual environment.

$ python -a

Looking for VOCALOID trading cards?

Check out Sakura Blossom Trading Post