6
votes

Depending on which installation of Python I am using I have some problems to load a module. When I type

from quantecon import approx_markov

in the terminal using Python 3.4.0, the following error message is returned:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/quantecon/__init__.py", line 6,in <module> 
    from asset_pricing import AssetPrices
ImportError: No module named 'asset_pricing'

In the folder /usr/... as referred to above, I do however find a module called asset_pricing. (I have to admit that I additionally do not understand why the module asset_pricing interferes.)

I installed quantecon with:

pip3 install quantecon 

I suspect that the problems are related to the Python version I am using. I also installed

pip install quantecon

and when I call the module approx_markov form the terminal, using Python 2.7.6 (I think this is the standard Python version of the OS I am using) I do not receive any error message. To solve the problem I already followed the instruction in the following discussion but to no avail Python3 has no acces to python2 modules (ubuntu).

1
Thank you for editing, Martijn. - fabian

1 Answers

7
votes

The currently released version of quantecon is not Python 3 compatible; it uses relative imports and these are not supported anymore in Python 3.

The version in the source repository has been refactored and updated, and looks like it'll work with Python 3. You'll need to install that version instead:

pip3 install -U git+https://github.com/jstac/quant-econ.git

where -U tells pip3 to upgrade the package.

Note that there have been a lot of changes recently; use at your own risk. You could stick with Python 2 and wait for an official release.