Directory for Python installation?

91 views
Skip to first unread message

19yc93

unread,
Jun 11, 2018, 11:22:41 AM6/11/18
to ProjectChrono
Hello,

I am trying to install the Python module under Linux. I have installed Python with the Anaconda distribution.

I don't know how to set up the following under CMake:

PYTHON_EXECUTABLE
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
PYTHON_LIBRARY_DEBUG
PYTHON_LIBRARY_RELEASE

Can anybody help?
Thanks

19yc93

unread,
Jun 12, 2018, 7:28:52 AM6/12/18
to ProjectChrono
In Cmake-GUI I was able to successfully press "Configure" without error messages.
My configuration was the following:

PYTHON_EXECUTABLE: /home/my_username/anaconda3/bin/python3.6
PYTHON_INCLUDE_DIR: /home/my_username/anaconda3/include
PYTHON_LIBRARY: /home/my_username/anaconda3/lib/libpython3.6m.so
PYTHON_LIBRARY_DEBUG: empty
PYTHON_LIBRARY_RELEASE: empty

After that I switched in terminal to my build directory and I started with "sudo make", but after 98% it aborted with the following message:

Scanning dependencies of target _ChronoEngine_python_core
[ 98%] Building CXX object src/chrono_python/CMakeFiles/_ChronoEngine_python_core.dir/__/__/swig/ChModuleCorePYTHON_wrap.cxx.o
/opt/chrono/build/swig/ChModuleCorePYTHON_wrap.cxx:174:21: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
compilation terminated
.
src
/chrono_python/CMakeFiles/_ChronoEngine_python_core.dir/build.make:70: die Regel für Ziel src/chrono_python/CMakeFiles/_ChronoEngine_python_core.dir/__/__/swig/ChModuleCorePYTHON_wrap.cxx.o scheiterte
make
[2]: *** [src/chrono_python/CMakeFiles/_ChronoEngine_python_core.dir/__/__/swig/ChModuleCorePYTHON_wrap.cxx.o] Fehler 1
CMakeFiles/Makefile2:346: die Regel für Ziel src/chrono_python/CMakeFiles/_ChronoEngine_python_core.dir/all scheiterte
make
[1]: *** [src/chrono_python/CMakeFiles/_ChronoEngine_python_core.dir/all] Fehler 2
Makefile:160: die Regel für Ziel all scheiterte
make
: *** [all] Fehler 2

On line 3 "Datei oder Verzeichnis nicht gefunden" means "file or directory not found".

I would be grateful if anybody could help me out ;)
Thanks

19yc93

unread,
Jun 12, 2018, 11:48:51 AM6/12/18
to ProjectChrono
After another try-and-error I got it. I will share it with you. This was done with KDE Neon (which is based on Ubuntu 16.04 LTS).

  • I suppose that you installed Chrono like this. If not, you should maybe install some missing packages.
  • Install SWIG. Download Ver. 3.0.12 and unzip it where ever you want. Go to the unzipped folder to /Doc/Manual/Preface.html and follow the installation instructions.
  • Open a new Terminal window and type:
    sudo cmake-gui
  • Where is the source code:
    /opt/chrono/source
  • Where to build the binaries:
    /opt/chrono/build
  • Click on "Advanced"
  • Disable everything expect ENABLE_MODULE_PYTHON
  • PYTHON_EXECUTABLE: /home/my_username/anaconda3/bin/python3
  • PYTHON_INCLUDE_DIR: /home/my_username/anaconda3/include
  • PYTHON_LIBRARY: /home/my_username/anaconda3/lib/libpython3.6m.so
  • PYTHON_LIBRARY_DEBUG: empty
  • PYTHON_LIBRARY_RELEASE: empty
  • SWIG_DIR: /usr/local/share/swig/3.0.12
  • SWIG_EXECUTABLE: /usr/local/bin/swig
  • SWIG_VERSION: 3.0.12
  • Click Configure
  • Click Configure again
  • You should see in the upper Cmake window (in red color) something like
    To have access to the Chrono::Python wrapper modules, after building and (optionally) installing, append one of the following to the PYTHONPATH environment variable:      
    For the modules in the BUILD tree: ...
    For the modules in the INSTALL tree: ...
  • Copy that to your clipboard or in a text file (you need that later!)
  • Click Generate
  • Open a Terminal and type:
    cd /opt/chrono/build
    sudo make
    sudo make install
  • Edit your ".bashrc" file in your /home/YOUR_USER/ directory. You can do this with your Terminal:
    cd /home/YOUR_USER/
    YOUR_DEFAULT_EDITOR
    .bashrc
    # for example: kate .bashrc
    Add the following line to the .bashrc-file:
    export PYTHONPATH=YOUR_PATH
    Replace YOUR_PATH with the path you copied from "For the modules in the BUILD tree: ..." ! For example: export PYTHONPATH=/opt/chrono/build/bin/
  • Save the .bashrc file and close it
  • Done!

Reply all
Reply to author
Forward
0 new messages