Python cannot import neuron library on Windows install

Post Reply
pascal
Posts: 106
Joined: Thu Apr 26, 2012 11:51 am

Python cannot import neuron library on Windows install

Post by pascal »

I'm having trouble installing NEURON 8.2 on Windows 11. I installed NEURON 8.2 using the installer from the website, then installed Anaconda. When I open Python and type from neuron import h, I get this:

Traceback (most recent call last):
File "c:\nrn\lib\python\neuron\__init__.py", line 135, in <module>
from . import hoc
ImportError: cannot import name 'hoc' from partially initialized module 'neuron' (most likely due to a circular import) (c:\nrn\lib\python\neuron\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\nrn\lib\python\neuron\__init__.py", line 137, in <module>
import neuron.hoc
ModuleNotFoundError: No module named 'neuron.hoc'
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Python cannot import neuron library on Windows install

Post by ted »

Uninstall NEURON, then reinstall it.
pascal
Posts: 106
Joined: Thu Apr 26, 2012 11:51 am

Re: Python cannot import neuron library on Windows install

Post by pascal »

Uninstalled, reinstalled, restarted...still the exact same error message.
pascal
Posts: 106
Joined: Thu Apr 26, 2012 11:51 am

Re: Python cannot import neuron library on Windows install

Post by pascal »

All right, finally got it working. I uninstalled both NEURON and Anaconda. I then re-installed them, but installed Anaconda first, and NEURON second. (Before, the order was reversed.) I'm not sure why, but the order of installation seemed to matter, at least in my case.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Python cannot import neuron library on Windows install

Post by ted »

Thanks for the followup on that. I always adivse users to install Python first, then NEURON. The fact that you had to uninstall both, then install Python, and finally NEURON, doubtless contains a clue . . . if we're smart enough to figure out what it might be.
Post Reply