After updating to MacOS 12.3 Monterey

A Python package that facilitates development and use of models of biological neural networks

Moderator: tom_morse

Post Reply
malihaahmed
Posts: 6
Joined: Thu Nov 05, 2020 8:01 pm

After updating to MacOS 12.3 Monterey

Post by malihaahmed »

Hi,
I'm getting the following error since updating to MacOS 12.3 and also after reinstalling NEURON on my computer. Any insight on this would be appreciated.

Thank you

Code: Select all

ImportError                               Traceback (most recent call last)
/Applications/NEURON/lib/python/neuron/__init__.py in <module>
    134 try:
--> 135     from . import hoc
    136 except:

ImportError: cannot import name 'hoc' from 'neuron' (/Applications/NEURON/lib/python/neuron/__init__.py)

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-62766daa135f> in <module>
----> 1 from netpyne import specs, sim
      2 get_ipython().run_line_magic('matplotlib', 'inline')
      3 import numpy as np
      4 import matplotlib.pyplot as plt
      5 

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/__init__.py in <module>
     19     matplotlib.use('Agg')
     20 
---> 21 from netpyne import analysis
     22 from netpyne import batch
     23 from netpyne import cell

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/analysis/__init__.py in <module>
     34 # Import spike-related functions
     35 # -------------------------------------------------------------------------------------------------------------------
---> 36 from .spikes import calculateRate, plotRates, plotSyncs, plotRaster, plotSpikeHist, plotSpikeStats, \
     37     plotRatePSD, plotRateSpectrogram, popAvgRates, plotfI
     38 

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/analysis/spikes.py in <module>
     30 import pandas as pd
     31 import scipy
---> 32 from ..specs import Dict
     33 from .utils import colorList, exception, getCellsInclude, getSpktSpkid, _showFigure, _saveFigData, syncMeasure, _smooth1d
     34 

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/specs/__init__.py in <module>
     11 standard_library.install_aliases()
     12 from .dicts import Dict, ODict
---> 13 from .netParams import NetParams, CellParams
     14 from .simConfig import SimConfig

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/specs/netParams.py in <module>
     24 from collections import OrderedDict
     25 from .dicts import Dict, ODict
---> 26 from .. import conversion
     27 
     28 # ----------------------------------------------------------------------------

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/conversion/__init__.py in <module>
     10 standard_library.install_aliases()
     11 
---> 12 from .neuronPyHoc import importCell, importCellsFromNet, mechVarList, getSecName
     13 from .pythonScript import createPythonScript
     14 from .excel import importConnFromExcel

/Applications/anaconda3/lib/python3.7/site-packages/netpyne/conversion/neuronPyHoc.py in <module>
     18 import os, sys, signal
     19 from numbers import Number
---> 20 from neuron import h
     21 import importlib
     22 

/Applications/NEURON/lib/python/neuron/__init__.py in <module>
    135     from . import hoc
    136 except:
--> 137     import neuron.hoc
    138 
    139 import nrn

ModuleNotFoundError: No module named 'neuron.hoc'
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: After updating to MacOS 12.3 Monterey

Post by ramcdougal »

This looks like an install from the PKG installer?

In particular, you'll find you have a NEURON folder in Applications. Remove that, and then enter the following into the terminal:

Code: Select all

pip3 install neuron
malihaahmed
Posts: 6
Joined: Thu Nov 05, 2020 8:01 pm

Re: After updating to MacOS 12.3 Monterey

Post by malihaahmed »

Yes, I installed the pkg Michael had posted in another thread (viewtopic.php?t=4484) since I had a similar problem.

Your suggestion works- thank you!

However, I'm unable to recompile my mod files as there's no NEURON folder in the Applications, and hence no compiler that I can see at least..
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: After updating to MacOS 12.3 Monterey

Post by ted »

I'm unable to recompile my mod files as there's no NEURON folder in the Applications, and hence no compiler that I can see at least..
Try opening a terminal, cd to the folder that contains your mod files, then at the system prompt execute the command
nrnivmodl

Did that work?
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: After updating to MacOS 12.3 Monterey

Post by hines »

Perhaps you have not installed the xcode command line tools. From a Terminal, type

Code: Select all

xcode-select --install
and see if that fixes the problem.

Although I'm curious about why you had a import error when importing neuron after a package install. No need to pursue that now since your pip install
fixed the issue.
malihaahmed
Posts: 6
Joined: Thu Nov 05, 2020 8:01 pm

Re: After updating to MacOS 12.3 Monterey

Post by malihaahmed »

Try opening a terminal, cd to the folder that contains your mod files, then at the system prompt execute the command
nrnivmodl
Did that work?
Yes, it did! Thank you very much for your quick response. I really appreciate it!
Post Reply