Pybrain not working with Python 3.6.1 - python

I installed Python 3.6.1. And then installed pybrain using git (See Screen Shot). Then when I useimport pybrainit works but afterwards when I usefrom pybrain.tools.shortcuts import buildNetworkit gives me error that: Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pybrain
>>> from pybrain.tools.shortcuts import buildNetwork
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from pybrain.tools.shortcuts import buildNetwork
File "C:\Users\davm5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pybrain\tools\shortcuts.py", line 14
except ImportError, e:
SyntaxError: invalid syntax.
>>> from pybrain.structure import TanhLayer
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from pybrain.structure import TanhLayer
File "C:\Users\davm5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pybrain\structure\__init__.py", line 1, in <module>
from connections.__init__ import *
ModuleNotFoundError: No module named 'connections'
Why is it doing like this? Kindly help me out here. Thanks
EDIT: Excluded screen shots. Added everything in post as per request.

except ImportError, e is Python 2 syntax and you've tried to run the code with Python 3. Install the latest version — the code seems to be fixed in git (it's except ImportError as e now, so it's suitable for both Python 2.7 and Python 3).

Just an update: I was able to resolve the issue by un-installing python, then installing python 3.6.2 (64 bit), using pip3 (pip3 install pybrain) I was able to install the latest version of pybrain which worked flawlessly. Thanks to everyone who tried to help me out when I was fairly new to python. Love this community!!

Related

Issues importing pymssql in Python3 while using conda environment

I am having trouble importing a library called pymssql.
I have read previous solutions regarding this issue on stack overflow. The following are the solutions that did not work:
Error importing pymssql
import pymssql Unicode DecodeError in windows 7
I am running a conda virtual environment with Python 3.7.9. The following is the output when I run python in the terminal.
Python 3.7.9 (default, Aug 31 2020, 07:22:35)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
So, this confirmed that I was using the correct Python version. Next, I tried to import a library called pymssql.
This looked like:
>>> import pymssql
This returned an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/__init__.py", line 3, in <module>
from ._pymssql import *
File "src/pymssql/_pymssql.pyx", line 1, in init pymssql._pymssql
ImportError: dlopen(/usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/_mssql.cpython-37m-darwin.so, 2): Symbol not found: _iconv
Referenced from: /usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/_mssql.cpython-37m-darwin.so
Expected in: flat namespace
in /usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/_mssql.cpython-37m-darwin.so
>>>
I have tried conda install pymssql and pip install pymssql. Neither of these solved the issue.

ciscoconfparse unable to import python3.7 win10

Any new solution for this. I am unable to from ciscoconfparse import CiscoConfParse
I tried several versions of ciscoconfparse in python3 usin gpowershell in windows10.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ciscoconfparse import CiscoConfParse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python3\lib\site-packages\ciscoconfparse\__init__.py", line 1, in <module>
from .ciscoconfparse import *
File "C:\Python3\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 4018
^
SyntaxError: invalid syntax
I still have not found a version that will let me import the module.
I browsed through several links here..but did not find an answer. The closest issue to mine is:
ciscoconfparse in Python 3.4 module doesn't import correctly
but not answer.
Any new info?
Thanks
I have reproduced the bug where Win10 and Python 3.7.0 cause problems.
FWIW, if you completely uninstall Python 3.7.0 (including manually deleting your Windows installation directory tree), then install Python 3.7.1, you should not have this problem with Windows 10.

No module named 'Twisted'

I just installed Python to start experimenting a bit with Scrapy.
Found a tutorial to first install Miniconda and with this I was able to install Scrapy. Now the problem is that the software I'm trying to run also requires Twisted. So I installed twisted with pip.
Twisted seems to have been installed correctly but I'm still getting an error when running the script that the Twisted module could not be found.
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\xampp\htdocs\crawler\crawler.py ================
Traceback (most recent call last):
File "C:\xampp\htdocs\crawler\crawler.py", line 3, in <module>
from scrapy.utils.project import get_project_settings
File "C:\xampp\htdocs\crawler\scrapy\__init__.py", line 43, in <module>
from twisted import version as _txv
ModuleNotFoundError: No module named 'twisted'
>>>
================ RESTART: C:\xampp\htdocs\crawler\crawler.py ================
Traceback (most recent call last):
File "C:\xampp\htdocs\crawler\crawler.py", line 3, in <module>
from scrapy.utils.project import get_project_settings
File "C:\xampp\htdocs\crawler\scrapy\__init__.py", line 43, in <module>
from twisted import version as _txv
ModuleNotFoundError: No module named 'twisted'
>>>
Anybody a suggestion?
Thanks in advance,
You installed twisted for python2. When you use the command pip , you are installing a package for python2. You are using python3 (3.6.3). To install twisted for python3, you have to do:
pip3 install twisted
I hope this helps.
To try if twisted correctly installed, start python interpreter and type
import twisted
If you can't import twisted, you should check if it is in your python path.
Python path can be checked in the python interpreter as
import sys
print sys.path
The directory, where your twisted is installed has to be among those folders.

No module named machinery

I am trying to make exe using py2exe in Python. When I import py2exe I am getting error like this:
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import py2exe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\__init__.py", line 9, in <module>
patch_distutils()
File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\patch_distutils.py", line 68, in patch_distutils
from . import distutils_buildexe
File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\distutils_buildexe.py", line 91, in <module>
from . import runtime
File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\runtime.py", line 3, in <module>
from .dllfinder import Scanner, pydll
File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\dllfinder.py", line 7, in <module>
from importlib.machinery import EXTENSION_SUFFIXES
ImportError: No module named machinery
Can any body help me fixing this out. I am not getting machinery module any where.
I just ran into this myself. I had installed 0.9 from pypi as well. If you look at the pypi page here py2exe on pypi, you'll see that the download only supports Python 3.3 and later and you should use the 0.6 download from here. I deleted the 0.9 egg after installing 0.6 and it worked after that.
I had same issue, because i had version py2exe0.9 and it is not supported for python2.7.
I downloaded lower version from here http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe/download
and it works.

Python 2.6 complains about missing a math module - I cannot use it after some (other) software update. Any tips?

I am relatively new with Python. Here is my problem:
My environment was python2.6 with MacOs 10.6.8. I recently had to update my system with Python2.7 and some other stuff (Eclipse 3.6 and GoogleAppEngine). Python works fine within Eclipse, however, I want to keep the shell-mode in being able to quickly test small stuff on the commandline. I am getting this error message, and I need this to get rid of asap:
$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> import urllib2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py",
line 92, in <module>
import httplib
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py",
line 77, in <module>
import mimetools
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/mimetools.py",
line 6, in <module>
import tempfile
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/tempfile.py",
line 34, in <module>
from random import Random as _Random
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/random.py",
line 45, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/lib-dynload/math.so, 2): Symbol not found: __PyLong_AsScaledDouble
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
/lib-dynload/math.so
Expected in: flat namespace
in /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/math.so
Anyway, this was the python version that my macbook was shipped with at buying time. I don't think i want to waste time on removing, re-stalling etc. an apple-approved python version. Does anybody know how I can get my system back to run properly? And why does this error occur at all? Thanks for quick help!
Try to run your new python within a virtualenv, so that it is isolated from the system install.
http://pypi.python.org/pypi/virtualenv

Categories

Resources