Emily
Emily

Reputation: 2331

Why imports are not found (when they exist)?

I'm getting an "unresolved reference" error for imports, when the imports exist. What might cause this?

The details:

I'm developing in Pycharm, Python 3.5 32 bit virtual environment.

I'm getting import errors with the Quantopian Zipline library.

I've imported Zipline in Pycharm Project Interpreter.

enter image description here

I'm getting import errors using the example code in the Zipline library...

from zipline.api import order, record, symbol

enter image description here

What's going on here?

Upvotes: 0

Views: 229

Answers (1)

phihag
phihag

Reputation: 288260

If you look at the stack frame, you see that it is structured as follows:

  1. buyapple.py imports zipline
  2. zipline imports logbook
  3. logbook imports gevent
  4. gevent fails to load

So the module is there, is found, but in the course of importing zipline, zipline itself imports another module, and that module imports yet another module, and that module fails.

Something is wrong with the gevent installation - to be more precise, the compiled binary is missing functions that the Python part of the module calls. One simple step you can do is try reinstalling it (via pip install -U gevent or equivalent) and see whether that works.

Upvotes: 1

Related Questions