0

Hi I am new to Python I want to use an already developed tool/code and I have a problem with the modules used. I installed Spider with Anaconda version of Python

I am trying to run below code,
https://code.google.com/p/quantandfinancial/source/browse/trunk/example_black_litterman.py

if I understood the code correctly it is referencing the below custom module https://code.google.com/p/quantandfinancial/source/browse/trunk/structures/quote.py?r=25

I stored the two parts of the code in C:\Users\Michal\Documents\Python Scripts and Python is installed in C:\Anaconda3, when I run the code I get an error

File "C:/Users/Michal/Documents/Python Scripts/Black-Litterman.py", line 4, in <module>
    from structures.quote import QuoteSeries
ImportError: No module named 'structures'

Please help how can I get this code running?

2 Answers 2

1

pip install structures worked for me from normal windows cmd

C:\Users\user>pip install structures

You are using pip version 7.0.3, however version 7.1.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

> Collecting structures   
> Downloading structures-2.0.2.tar.bz2
> Installing collected packages: structures   
> Running setup.py install for structures 
> Successfully installed structures-2.0.2
Sign up to request clarification or add additional context in comments.

Comments

0

You need to do this:

pip install structures

Best idea is probably to first make a conda environment, then you can manage all the packages you need in there.

4 Comments

is the "structures" a package? I thought it was just a module which is referenced from the main code and I need to place it somewhere in one of python's folders. Where should I run the fist command? I tried in the console but I get "Invalid syntax" error
Yes, structures is a package. Run pip on the command line (that is, not in the Python interpreter).
It doesn't get installed, syntax error: Python 3.5.0 |Anaconda 2.4.0 (64-bit)| (default, Oct 20 2015, 07:26:33) [MSC v.1 900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> pip install structures File "<stdin>", line 1 pip install structures ^ SyntaxError: invalid syntax
still the same, "invalid syntax", I closed spider, typed exit() on the command (C:\Anaconda3\python.exe) and then tried the "pip install structures" the reference in the main code is ("4 from structures.quote import QuoteSeries") should the name of the package different? how about the location of the file, is the "Python Scripts" in my Documents fine? >>> pip install structures File "<stdin>", line 1 pip install structures ^ SyntaxError: invalid syntax >>>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.