Author Topic: issue with importing matplot and ovito  (Read 69 times)

leila

  • Newbie
  • *
  • Posts: 7
issue with importing matplot and ovito
« on: November 19, 2018, 05:27:19 PM »
Hi all,

I am trying to run a code using ovitos which has "import matplotlib.pyplot as plt" . However,  I get this error:

ImportError: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /home/leila/anaconda3/lib/python3.6/site-packages/matplotlib/../../../libpng16.so.16)

Then I tried to add "export LD_LIBRARY_PATH=/home/leila/anaconda3/lib:$LD_LIBRARY_PATH" to my bashrc. But this time,  I got this error:

This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".
Available platform plugins are: minimal, offscreen, vnc, xcb.

Reinstalling the application may fix this problem.
Aborted

Thank you in advance,
Leila

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 512
Re: issue with importing matplot and ovito
« Reply #1 on: November 20, 2018, 11:03:03 AM »
Hi Leila,

I am not entirely sure what is happening here, but there probably is a conflict between multiple versions of the zlib library on your system: one in the system directory and one in the Anaconda installation directory.

Ovito should use only the library version from the Linux system directory. By setting the LD_LIBRARY_PATH environment variable you seem to be creating a new problem: Now Ovito may load some of the Qt libraries from the Anaconda directory, which leads to a compatibility problem with the internal Qt libraries of Ovito and the initialization of the application fails completely.

Please try running ovitos without the LD_LIBRARY_PATH and PYTHON_PATH environment variables set, e.g.:

   LD_LIBRARY_PATH=  PYTHON_PATH= ./bin/ovitos myscript.py

Instead of clearing these variables during invocation of ovitos, you can also use:

   export LD_LIBRARY_PATH=
   export PYTHON_PATH=

Note that ovitos comes with its own copy of the matplotlib module. Thus, you don't need to pull anything in from the Anaconda installation, which typically includes modules and libraries that are incompatible with the Python interpreter shipping with Ovito.

-Alex

leila

  • Newbie
  • *
  • Posts: 7
Re: issue with importing matplot and ovito
« Reply #2 on: November 20, 2018, 04:04:10 PM »
Thank you so much Alex.
You are right. The issue was pulling some libraries from Anaconda.

I removed all the LD_LIBRARY_PATH and PYTHON_PATH and installed all the packages I needed in the ovitos interpreter. It solved my problem :)

Thanks,
Leila