kpeeters / cadabra2

A field-theory motivated approach to computer algebra.
https://cadabra.science/
GNU General Public License v3.0
223 stars 37 forks source link

cadabra2 ModuleNotFoundError in jupyter #58

Closed supercuerda closed 6 years ago

supercuerda commented 6 years ago

Hi,

I'm new using python and I'm willing to work with cadabra2 from Jupyter. I tried to start a Jupyter notebook from an Anaconda installation by importing first cadabra2 (installed in Ubuntu 16.04LTS). I do this:

from cadabra2 import *

and get this:

ModuleNotFoundError Traceback (most recent call last)

in () ----> 1 from cadabra2 import * ModuleNotFoundError: No module named 'cadabra2' Could you please help me to run this correctly?
kpeeters commented 6 years ago

Are you running a python3 kernel? It won't work if you start a python2 kernel.

supercuerda commented 6 years ago

Yes, it is python3. If it helps my python version is: Python 3.6.2 :: Anaconda, Inc.

kpeeters commented 6 years ago

Ah, didn't spot that you were using Anaconda. That's a tricky one. The problem is that if you run an Anaconda-supplied python, you will not be able to import packages which are supplied in the form of .deb packages, or which were built by hand against the system-supplied python.

You might try to build cadabra from source (first uninstall the .deb package though). The configure stage should show some signs of picking up python from Anaconda.

supercuerda commented 6 years ago

I uninstalled cadabra2 and tried to build cadabra from the source as you suggested. Following the correspondent instructions in https://github.com/kpeeters/cadabra2#linux-debian-ubuntu-mint I did:

$ git clone https://github.com/kpeeters/cadabra2 $ cd cadabra2 $ mkdir build $ cd build $ cmake ..

Everything is fine until there but:

$ make

yields: make: *** No targets specified and no makefile found. Stop.

By the way, when after $cmake i found that -- Found python /home/me/anaconda3/lib/libpython3.6m.so

kpeeters commented 6 years ago

Did cmake complete without errors? It does pick up the correct python library, but it may be missing something else.

supercuerda commented 6 years ago

CMakeOutput.log Actually not (sorry I didn't pay attention to this). I get:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: Boost_INCLUDE_DIR (ADVANCED) used as include directory in directory /home/me/cadabra2/core

etcetera... and finally

-- Configuring incomplete, errors occurred!

See the log file attached please.

kpeeters commented 6 years ago

Attach the full cmake output please. I suspect that Anaconda does not supply a boost.python...

supercuerda commented 6 years ago

CMakeOutput.log

here it is.

supercuerda commented 6 years ago

Actually, I wasn't able to make it work properly. I gave up and uninstall anaconda. Then I reinstalled Cadabra2 and it works. Thanks for your answer.

kpeeters commented 6 years ago

The current version on github can be built against anaconda instead of the system python. I'm closing the issue for now, but if you run into related problems feel free to re-open.