So I spend last night trying to install nest (and pynest) to use with PyNN, and I am currently stuck. When I try to import nest I get:
>>> import nest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nest/__init__.py", line 52, in <module>
from . import pynestkernel as _kernel
ImportError: cannot import name pynestkernel
However, when I make the make installcheck it passes all the pynest tests.
I am using OS x Yosemite, and I did a new install of python 2.7.9 using macport.
Tried:
easy_install python-nest
Now I am getting a new error.
Getting:
>>> import pyNN.nest as sim
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyNN.nest as sim
File "/Library/Python/2.7/site-packages/pyNN/nest/__init__.py", line 13, in <module>
from pyNN.nest import simulator
File "/Library/Python/2.7/site-packages/pyNN/nest/simulator.py", line 500, in <module>
state = _State() # a Singleton, so only a single instance ever exists
File "/Library/Python/2.7/site-packages/pyNN/nest/simulator.py", line 60, in __init__
self._cache_num_processes = nest.GetKernelStatus()['num_processes'] # avoids blocking if only some nodes call num_processes
AttributeError: 'module' object has no attribute 'GetKernelStatus'
Try using setuptools to install nest with easy_install python-nest.
I am trying something similar, with the further goal of having it working with python 3. So far I used the following commands:
git clone https://github.com/nest/nest-simulator.git
cd nest-simulator
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/nest -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -DPYTHON_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib .
make
make install
which runs without errors and I can happily run nest. Iam still having troubles running pyNN (see https://laurentperrinet.github.io/sciblog/posts/2016-06-01-compiling-and-using-pynn-%2B-nest-%2B-python3.html)
Related
Good afternoon, For the second day I can't move forward because of this problem. I've been doing python recently. I downloaded all packages, checked with the versions I have python 3.10. And it gives this error every time. Tell me what to do, please.
D:\pythonProject\venv\Scripts\python.exe D:\pythonProject\main.py
Traceback (most recent call last):
File "D:\pythonProject\main.py", line 1, in <module>
from imageai.Detection import ObjectDetection
File "D:\pythonProject\venv\lib\site-packages\imageai\Detection\__init__.py", line 2, in <module>
from imageai.Detection.keras_retinanet.models.resnet import resnet50_retinanet
File "D:\pythonProject\venv\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 19, in <module>
import keras
ModuleNotFoundError: No module named 'keras'
Process finished with exit code 1
Deleted, changed the interpreter (PyCharm to VS), changed the file paths.
I've tried running a program which imports the Pandapower library, and I get the Error:
NameError: name 'TextPath' is not defined
I installed Pandapower via pip install normally, and it works good, but it seems to have Problems with "pandapower.plotting.collections" and the class "class CustomTextPath(TextPath):"
Minimal Code:
import pandapower as pp
import pandapower.plotting as plot
TracebacK:
Traceback (most recent call last): File "-\Test.py", line 2, in <module> import pandapower.plotting as plot File "-\Python\Python310\lib\site-packages\pandapower\plotting\__init__.py", line 1, in <module> from pandapower.plotting.collections import * File "-\Python\Python310\lib\site-packages\pandapower\plotting\collections.py", line 36, in <module> class CustomTextPath(TextPath): NameError: name 'TextPath' is not defined
This is a bug in pandapower. They depend on having matplotlib installed. The code catches its absence with a try/except but still tries to use the elements it would have imported. So, do a pip install matplotlib and you should be good.
I have uninstalled and re-installed the latest version of datatable from the repo
16:42:49/seirdc2.March8.in $sudo pip3 install 'datatable==0.10.1'
Successfully installed datatable-0.10.1
Let's see the version:
import datatable as dt
print(f'datatable version={dt.__version__}')
Um oops !
Traceback (most recent call last):
File "/git/corona/python/pointr/experiments/python/datatable.py", line 18, in <module>
import datatable as dt
File "/git/corona/python/pointr/experiments/python/datatable.py", line 19, in <module>
print(f'datatable version={dt.__version__}')
AttributeError: module 'datatable' has no attribute '__version__'
But why?
Note: I have seen other strangeness with this package: e.g. not finding Frame - though not consistently.
It appears that the problem has nothing to do with datatable. Look at the traceback:
Traceback (most recent call last):
File "/git/corona/python/pointr/experiments/python/datatable.py", line 18, in <module>
import datatable as dt
File "/git/corona/python/pointr/experiments/python/datatable.py", line 19, in <module>
print(f'datatable version={dt.__version__}')
AttributeError: module 'datatable' has no attribute '__version__'
Doesn't it strike you as suspicious that you have line 18 "calling" line 19? I mean, how could it be? Here's how:
When you name your script datatable.py and then do import datatable, then instead of importing the actual module from site-packages, it imports the "module" datatable.py instead. Basically, the file imports itself. And the way python manages imports, is that it creates a "stub" module in the sys.modules first (in order to prevent infinite recursions during imports). In your case, the module tries to import itself, so the stub module is fetched instead -- and then when you try to print its __version__ variable, turns out it doesn't exist.
You can verify this by printing dt.__file__ instead, which should show the location of the file that is being imported.
Needless to say, all this is not specific to datatable in any way; for example if you created a file numpy.py and then tried to import numpy, you'd run into same problems.
I try to import discord in python 3.5, but I get the following traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\Python35-32\lib\site-packages\discord\__init__.py", line 20, in <module>
from .client import Client, AppInfo, ChannelPermissions
File "C:\Python\Python35-32\lib\site- packages\discord\client.py", line 42, in <module>
from .voice_client import VoiceClient
File "C:\Python\Python35-32\lib\site- packages\discord\voice_client.py", line 65, in <module>
from .gateway import *
File "C:\Python\Python35-32\lib\site- packages\discord\gateway.py", line 31, in <module>
import aiohttp
File "C:\Python\Python35-32\lib\site- packages\aiohttp\__init__.py", line 10, in <module>
from .protocol import * # noqa
File "C:\Python\Python35-32\lib\site- packages\aiohttp\protocol.py", line 11, in <module>
from wsgiref.handlers import format_date_time
ImportError: cannot import name 'format_date_time'
I installed discord inside Python35-32\Scripts using pip install discord. Additionally, I installed asyncio using pip install asyncio in the same directory.
The error pops up in my command prompt, when I type in "python", wait for it to open, and then type "import discord". I'm saying that just to be clear that it's not a "I have a file named XXX.py which clashes with something from the discord library" type of error.
Based on the comments you have added and the line
File "C:\Python\Python35-32\lib\site- packages\aiohttp\protocol.py", line 11, in <module>
from wsgiref.handlers import format_date_time
ImportError: cannot import name 'format_date_time'
The problem seems to be that 'format_date_time' could not be imported from the built in library wsgiref. Turns out that the file ...\Python35-32\lib\wsgiref\handlers.py was completely empty indicating that something corrupted your python installation.
Two possible solutions:
Reinstall your python completely which also has the benefit of solving other potential corruptions that you might not have noticed yet (Note that the underlying cause for this corruption remains unknown)
Go into the Cython git and copy the contents of the handlers.py into the local file. This is a very specific solution however and you should be aware that other parts of your python installation might also be corrupt.
Maybe you wanted to pip install discord.py instead of discord?
I'm trying to run a simple code to test that I have installed correctly pyexiv2 in my computer. I'm using python 2.6.6. on windows 7 64 bit
So I run this simple code:
import pyexiv2
print pyexiv2.exiv2_version_info
and I get this error:
Traceback (most recent call last):
File "C:/Users/Usuario/Desktop/pyexiv2/pyexiv2.py", line 1, in <module>
import pyexiv2
File "C:\Users\Usuario\Desktop\pyexiv2\pyexiv2.py", line 3, in <module>
print pyexiv2.version_info
AttributeError: 'module' object has no attribute 'version_info'
How can I fix that? Thank you
You named your own file pyexiv2.py as well; rename it or delete it, as it is being imported instead of the installed module.