Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cx_Freeze error: baseline image directory does not exist

I'm trying to create an executable file out of a python scripts on Windows in Anaconda virtual environment with cx_Freeze library. I was trying to do it with version 6.1 but I was stucked in the error Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll. Then I upgrade cx_Freeze to version 6.2 and this is the output I get when I run python setup.py build:

running build
running build_exe
C:\Users\--\Anaconda3\lib\site-packages\cx_Freeze\finder.py:309: VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
    Install tornado itself to use zmq with the tornado IOLoop.

  deferredImports, namespace = namespace)
Using TensorFlow backend.
2020-07-10 08:51:47.876748: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-07-10 08:51:47.885038: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
C:\Users\--\Anaconda3\lib\site-packages\IPython\html.py:14: ShimWarning: The IPython.html package has been deprecated since IPython 4.0. You should import from notebook instead. IPython.html.widgets has moved to ipywidgets.
  "IPython.html.widgets has moved to ipywidgets.", ShimWarning)
C:\Users\--\Anaconda3\lib\site-packages\IPython\kernel\__init__.py:13: ShimWarning: The IPython.kernel package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
error: The baseline image directory does not exist. This is most likely because the test data is not installed. You may need to install matplotlib from source to get the test data.

The following is the content of file setup.py:

from cx_Freeze import setup, Executable 
  
exe = Executable(script="mainDefectDetection.py",targetName="Test.exe")
setup(name = "try", version = "0.1", description = "", options = {'build_exe': {'include_files':["../../../../Anaconda3/Library/bin/mkl_intel_thread.dll"]}},executables = [exe])

I've tried to re-install matplotlib (pip uninstall matpolotlib, pip install matplotlib) but nothing has changed.

like image 782
Lota18- Avatar asked Jul 10 '20 07:07

Lota18-


2 Answers

My original answer: https://github.com/marcelotduarte/cx_Freeze/issues/692#issuecomment-657125847

I have already identified the source of this problem, it is the patch 7ec3eaa.

Using the matplot sample, I see an issue with numpy 1.18.3 to 1.19 and pillow 7.x, and I'm investigating.

For now, it has a workaround.

pip install "numpy<1.18.3" "pillow<7"

To build add ["matplotlib.tests", "numpy.random._examples"] to excludes or build with:

python setup.py build_exe --excludes=matplotlib.tests,numpy.random._examples

If you have a "excludes" in your setup.py, add the two excluded modules int it, options in setup is exclusive.

like image 72
Marcelo Duarte Avatar answered Nov 04 '22 10:11

Marcelo Duarte


Downgrading cx_freeze from version 6.2 to 6.1 made this error message go away. Now I have another error when running the executable: No module named mpl_toolkits.

I will edit my answer when I know more. I just wanted to answer right away, so you know someone else is having the same problem. :)

like image 30
jobusch Avatar answered Nov 04 '22 11:11

jobusch