Python Forum
[NEURON] Need help to import NEURON module into Python 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[NEURON] Need help to import NEURON module into Python 3
#1
Hello,

I need to use the NEURON module (https://neuron.yale.edu/neuron/) for a project research. Therefore, I have installed it (+ XQuartz + command line tools) and the GUI works properly. However, when I try to import/use it through a Python script, it raises this error:

Error:
Traceback (most recent call last): File "/Users/c/Desktop/import neuron.py", line 1, in <module> import neuron ModuleNotFoundError: No module named 'neuron'
Can you help me?
Thanks in advance.

P.-S.: I use macOS.
Reply
#2
probably you run the file with different python installation than the one where the neuron is installed
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Thanks for your reply.

Ultimately, I wrote a python path into my file .py linking the script to the module neuron located in python within the file NEURON 7.7 :

import sys
sys.path.insert(0, "/Applications/NEURON-7.7/nrn/lib/python")
It works properly but not for some imports for instance

from neuron import h, rxd
Error:
from neuron import h, rxd Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> from neuron import h, rxd File "/Applications/NEURON-7.7/nrn/lib/python/neuron/rxd/__init__.py", line 7, in <module> from . import rxd File "/Applications/NEURON-7.7/nrn/lib/python/neuron/rxd/rxd.py", line 2, in <module> from . import species, node, section1d, region File "/Applications/NEURON-7.7/nrn/lib/python/neuron/rxd/species.py", line 1, in <module> from .rxdmath import _Arithmeticed File "/Applications/NEURON-7.7/nrn/lib/python/neuron/rxd/rxdmath.py", line 2, in <module> import numpy ModuleNotFoundError: No module named 'numpy'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Spyder/Anaconda can't import objects from Vpython module AntonRuscov 0 2,246 Aug-25-2019, 05:20 PM
Last Post: AntonRuscov
  Why can't I import seaborn module? Athenaeum 1 6,435 Dec-09-2017, 08:40 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020