Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing to run NEST + Python 3 #382

Closed
laurentperrinet opened this issue Jun 1, 2016 · 12 comments
Closed

failing to run NEST + Python 3 #382

laurentperrinet opened this issue Jun 1, 2016 · 12 comments
Assignees
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next T: Bug Wrong statements in the code or documentation ZC: Installation DO NOT USE THIS LABEL ZP: Pending DO NOT USE THIS LABEL

Comments

@laurentperrinet
Copy link

laurentperrinet commented Jun 1, 2016

I could compile NEST wrt python3 on macosx (with homebrew) using

git clone https://github.com/nest/nest-simulator.git
cd nest-simulator
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/bin/nest -DPYTHON_EXECUTABLE=/usr/local/python3 -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m/ -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib .
make
make install

(see https://laurentperrinet.github.io/sciblog/posts/2016-06-01-compiling-and-using-pynn-%2B-nest-%2B-python3.html)
but I fail running an example:

 /usr/local/nest/share/doc/nest/examples/pynest on git:master o [0:19:37]
$ ipython balancedneuron.py
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/usr/local/nest/share/doc/nest/examples/pynest/balancedneuron.py in <module>()
     44 from scipy.optimize import bisect
     45
---> 46 import nest
     47 import nest.voltage_trace
     48

/usr/local/nest/lib/python3.5/site-packages/nest/__init__.py in <module>()
     55     sys.setdlopenflags(ctypes.RTLD_GLOBAL)
     56
---> 57 from . import pynestkernel as _kernel      # noqa
     58 from .lib import hl_api_helper as hl_api   # noqa
     59

ImportError: dlopen(/usr/local/nest/lib/python3.5/site-packages/nest/pynestkernel.so, 8): Symbol not found: __ZNK12lockPTRDatumIN4nest12AbstractMaskEXadL_ZNS0_14TopologyModule8MaskTypeEEEE4infoERNSt3__113basic_ostreamIcNS4_11char_traitsIcEEEE
  Referenced from: /usr/local/nest/lib/python3.5/site-packages/nest/pynestkernel.so
  Expected in: flat namespace
 in /usr/local/nest/lib/python3.5/site-packages/nest/pynestkernel.so

any guidance is welcome!

@heplesser
Copy link
Contributor

@Meduz We just added a formula for nest to Homebrew, so the recommended way to install NEST under OSX is now via Homebrew:

  1. Add the homebrew/science tap: execute brew tap homebrew/science
  2. For information on what options NEST has and what will be installed, execute brew info nest
  3. To install nest with Python, execute brew install nest --with-python. This will install the most recent release.
  4. To install the most recent Github version, use brew install nest --with-python --HEAD

If you want to build by hand, you must make sure that NEST does not use the clang compiler by adding -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 to the cmake call.

@laurentperrinet
Copy link
Author

laurentperrinet commented Jun 2, 2016

This seems perfectly timed!

As I wished to compile for python3, I used your second solution which worked perfectly.
(Sorry I could not test the brew recipe.)

Thanks a lot,
Laurent

PS: updated instructions on https://laurentperrinet.github.io/sciblog/posts/2016-06-01-compiling-and-using-pynn-%2B-nest-%2B-python3.html

@heplesser
Copy link
Contributor

@Meduz Great, and thank you for blogging about NEST! You may want to mention that the compiler switches to cmake are only necessary on OSX; under Linux, things should work without them.

@laurentperrinet
Copy link
Author

thanks for the feedback.

Do you plan to allow for users to mention the version of python they use? Like for numpy, the use of the brew install numpy --with-python3 option.

thanls,
Laurent

PS: @heplesser I did add a mention to that point

@heplesser
Copy link
Contributor

@tammoippen What do you think?

@laurentperrinet
Copy link
Author

laurentperrinet commented Mar 12, 2017

Thanks for implementing the homebrew formula with python 3. However I have some problems installing it. If I run the vanilla version, I get as expected:

$ brew install homebrew/science/nest
==> Reinstalling homebrew/science/nest
==> Downloading https://homebrew.bintray.com/bottles-science/nest-2.12.0_1.sierra.bottle.tar.gz
Already downloaded: /Users/lolo/Library/Caches/Homebrew/nest-2.12.0_1.sierra.bottle.tar.gz
==> Pouring nest-2.12.0_1.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/nest/2.12.0_1: 2,453 files, 19.2MB

but in the case of the py3k option, I get:

$ brew reinstall homebrew/science/nest  --with-python3

==> Reinstalling homebrew/science/nest --with-python3
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading https://github.com/nest/nest-simulator/releases/download/v2.12.0/nest-2.12.0.tar.gz
Already downloaded: /Users/lolo/Library/Caches/Homebrew/nest-2.12.0.tar.gz
==> cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/Cellar/nest/2.12.0_1 -Dwith-python=3
==> make
Last 15 lines from /Users/lolo/Library/Logs/Homebrew/nest/02.make:
      sli::pool::grow(unsigned long) in allocator.cpp.o
      TokenArray::~TokenArray() in arraydatum.cc.o
      lockPTRDatum<std::vector<long, std::allocator<long> >, &SLIInterpreter::IntVectortype>::clone() const in arraydatum.cc.o
      lockPTRDatum<std::vector<double, std::allocator<double> >, &SLIInterpreter::DoubleVectortype>::clone() const in arraydatum.cc.o
      lockPTR<std::vector<long, std::allocator<long> > >::~lockPTR() in arraydatum.cc.o
      lockPTR<std::vector<long, std::allocator<long> > >::~lockPTR() in arraydatum.cc.o
      ...
  "___cxa_throw_bad_array_new_length", referenced from:
      Processes::Sysexec_aFunction::execute(SLIInterpreter*) const in processes.cc.o
      RegexpModule::RegexecFunction::execute(SLIInterpreter*) const  in sliregexp.cc.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [sli/libsli.dylib] Error 1
make[1]: *** [sli/CMakeFiles/sli_lib.dir/all] Error 2
make: *** [all] Error 2

READ THIS: http://docs.brew.sh/Troubleshooting.html


any idea?

more info 👍

==> Formula
Tap: homebrew/science
Path: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/nest.rb
==> Configuration
HOMEBREW_VERSION: 1.1.11
ORIGIN: https://github.com/Homebrew/brew
HEAD: 394f9fa0aaa5854aa52bc589708a079665dcf462
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: daade4cc7eb54565ad3510acd8c99b28e1c9e5d7
Core tap last commit: 10 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.12.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_112, 1.8.0_40, 1.8.0_11
macOS: 10.12.3-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.112 => /opt/X11
==> ENV
HOMEBREW_CC: gcc-6
HOMEBREW_CXX: g++-6
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local/opt/readline:/usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
CMAKE_FRAMEWORK_PATH: /usr/local/opt/python3/Frameworks
MACOSX_DEPLOYMENT_TARGET: 10.12
PKG_CONFIG_PATH: /usr/local/opt/gsl/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/python3/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Homebrew/Library/Homebrew/shims/super:/usr/local/opt/gsl/bin:/usr/local/opt/numpy/bin:/usr/local/opt/libpng/bin:/usr/local/opt/freetype/bin:/usr/local/opt/libtool/bin:/usr/local/opt/cmake/bin:/usr/local/opt/python3/bin:/usr/local/opt/gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/Cellar/gcc/6.3.0_1/bin

Error: homebrew/science/nest 2.12.0 did not build

@heplesser
Copy link
Contributor

@tammoippen Could you take a look at this?

@heplesser heplesser added ZC: Installation DO NOT USE THIS LABEL I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) ZP: Pending DO NOT USE THIS LABEL S: High Should be handled next T: Bug Wrong statements in the code or documentation labels Mar 13, 2017
@tammoippen
Copy link
Contributor

Hi @laurentperrinet and @heplesser ,

I am looking into it.

@tammoippen
Copy link
Contributor

@laurentperrinet
I cannot reproduce your error. However, I created a PR on homebrew (https://github.com/Homebrew/homebrew-science/pull/5293) to get the right python3 dependancies. Maybe you can locally change these dependancies and try again:

brew edit homebrew/science/nest  # and add the   ' => "with-python3"' to numpy, scipy, matplotlib in python3 sction

If it still fails, please give the relevant output of brew install --verbose homebrew/science/nest --with-python3.

@tammoippen
Copy link
Contributor

Both of the nest related homebrew PR's are merged by now. @laurentperrinet , can you please state, whether there are still issues with installing nest via homebrew?

@heplesser
Copy link
Contributor

@laurentperrinet Do you still have problems with homebrew?� If not, would you close this issue?

@heplesser
Copy link
Contributor

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next T: Bug Wrong statements in the code or documentation ZC: Installation DO NOT USE THIS LABEL ZP: Pending DO NOT USE THIS LABEL
Projects
None yet
Development

No branches or pull requests

3 participants