Troubles in building the nrnpython for Neuron 7.1

Post Reply
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

Troubles in building the nrnpython for Neuron 7.1

Post by mattions »

Hello,

I'm trying to upgrade to the latest version of Neuron.
Compilation of Interview and Neuron works fine but I can't build the nrnpython.

It seems the setup.py coming with the package is somehow broken (or it's not well formed in my systems)

This is the error

Code: Select all

mattioni@pogo:nrnpython$ python setup.py install --prefix=~/local/
  File "setup.py", line 64
    = [ epre+libdirs[0],epre+libdirs[1] ],
    ^
SyntaxError: invalid syntax
and this is the part which cause trouble:

Code: Select all

hoc_module = Extension(
      "neuron.hoc",
      ["inithoc.cpp"],
      library_dirs=libdirs,
       = [ epre+libdirs[0],epre+libdirs[1] ],
      #extra_objects = [],
      libraries = [
	"nrnpython",
        "nrnoc", "oc", "nrniv", "ivoc",
        "memacs", "meschach", "neuron_gnu", "nrnmpi",
        "scopmath", "sparse13", "sundials", "IVhines",
	"readline"
      ],
      include_dirs = include_dirs,
      define_macros=defines
    )

Follows the whole file.

Code: Select all

#setup.py
from distutils.core import setup, Extension

import sys

# NRNPYTHON_DEFINES which were enabled at configure time
extern_defines = ""
nrnpython_exec = ""
nrn_srcdir = "."
if nrn_srcdir[0] != '/' :
    nrn_srcdir = '../../' + nrn_srcdir

if nrnpython_exec!=sys.executable:
    print "Error:"
    print "NEURON configure time python: "+nrnpython_exec
    print "Python presently executing setup.py: "+sys.executable
    print "These do not match, and the should!"
    sys.exit(1)


ldefs = extern_defines.split('-D')

# if using MPI then at least for linking need special paths and libraries
mpicc_bin = "gcc"
mpicxx_bin = "g++"
import os
os.environ["CC"]=mpicc_bin
os.environ["CXX"]=mpicxx_bin

# apparently we do not need the following
#################################
## following http://code.google.com/p/maroonmpi/wiki/Installation
## hack into distutils to replace the compiler in "linker_so" with mpicxx_bin
#
#import distutils
#import distutils.unixccompiler
#
#class MPI_UnixCCompiler(distutils.unixccompiler.UnixCCompiler):
#    __set_executable = distutils.unixccompiler.UnixCCompiler.set_executable
#
#    def set_executable(self,key,value):
#	print "MPI_UnixCCompiler ", key, " | ", value
#        if key == 'linker_so' and type(value) == str:
#            value = mpicxx_bin + ' ' + ' '.join(value.split()[1:])
#
#        return self.__set_executable(key,value)
#    
#distutils.unixccompiler.UnixCCompiler = MPI_UnixCCompiler
#################################

include_dirs = [nrn_srcdir+'/src/oc', '../oc']
defines = []

libdirs = ["/homes/mattioni/local/x86_64/lib",
  "/homes/mattioni/local/x86_64/lib"
]
epre='-Wl,-R'


hoc_module = Extension(
      "neuron.hoc",
      ["inithoc.cpp"],
      library_dirs=libdirs,
       = [ epre+libdirs[0],epre+libdirs[1] ],
      #extra_objects = [],
      libraries = [
	"nrnpython",
        "nrnoc", "oc", "nrniv", "ivoc",
        "memacs", "meschach", "neuron_gnu", "nrnmpi",
        "scopmath", "sparse13", "sundials", "IVhines",
	"readline"
      ],
      include_dirs = include_dirs,
      define_macros=defines
    )



setup(name="NEURON", version="7.0",
      description = "NEURON bindings for python",
      package_dir = {'':nrn_srcdir+'/share/lib/python'},
      packages=['neuron','neuron.tests'],
      ext_modules=[hoc_module]
)

hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Troubles in building the nrnpython for Neuron 7.1

Post by hines »

On a max os x that line is supposed to read
#extra_link_args = [ epre+libdirs[0],epre+libdirs[1] ],
and on all other machines it is supposed to read
extra_link_args = [ epre+libdirs[0],epre+libdirs[1] ],

I looked at the precursor file, setup.py.in which reads:
@setup_extra_link_args@ = [ epre+libdirs[0],epre+libdirs[1] ],
where configure decides what to put in place of the @...@ token.
In looking at nrn/m4/nrnpython.m4 I see that the only way this fails to
be set is if you configure with the '--with-nrnpython=dynamic' argument.
Is that how you are configuring?
Anyway, you can fix the setup.py file manually by putting in the correct
line above.
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

Re: Troubles in building the nrnpython for Neuron 7.1

Post by mattions »

Hi!

Actually I figured out that I was not giving the --with-nrnpython option.
that fix my setup and the installation work properly.

I misread somewhere that the python interpreter was built by default. Anyway happy ending. thanks.
Post Reply