Hello,
After I run a section of code in a Google Colab notebook I am getting an error that reads: ImportError: cannot import name 'nA' from 'neuron.units' (/usr/local/lib/python3.10/dist-packages/neuron/units.py)
-Somehow I cannot access any subdirectory in the folder /usr/local/ to attempt to find the neuron.units submodule. When I run NEURON through Python running from my terminal, the files from the NEURON that runs are in this other directory instead: /Users/tristan/Library/Python/3.8/lib/python/site-packages/neuron
The code section I have written on my Google Colab notebook is below, where the 2nd line causes the error.
from neuron import h
from neuron.units import mV, ms, μm, nA
h.load_file("stdrun.hoc")
Can someone help me resolve this issue? I am using a MacOS Monterey version 12.0.1. Thx
ImportError when importing the unit 'nA' from neuron.units
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: ImportError when importing the unit 'nA' from neuron.units
Yes, nA is not defined in neuron.units, and merely adding
nA = 1
to the list of "NEURON's default units" in the units.py file fixes the problem.
On my machine, units.py is in ~/.local/lib/python3.8/site-packages/neuron
nA = 1
to the list of "NEURON's default units" in the units.py file fixes the problem.
On my machine, units.py is in ~/.local/lib/python3.8/site-packages/neuron