Alright, I have tried a bunch of times the
python setup.py install
command from my command prompt
And when trying this:
from SimPy.Simulation import *
on Idle, I get this:
Traceback (most recent call last):
File "C:/Python30/pruebas/prueba1", line 1, in <module>
from SimPy.Simulation import *
File "C:\Python30\SimPy\Simulation.py", line 320
print 'SimPy.Simulation %s' %__version__,
^
SyntaxError: invalid syntax
>>>
Not every module supports python 3 - in fact, 90% or more of the modules are for 2.x now.
you should use 2.5 or 2.6 for this module, or find a simpy that is compatible with 3.0.
you can also run the 2->3 upgrade script to modify your simpy source, but I don't suggest doing that.
I have a similar error, and I Installed python 2.6.4, so I don't think you can solve your problem using an older version of python.
alumno#ubuntu:/usr/local/SimPy/SimPy$ python carro.py
Traceback (most recent call last):
File "carro.py", line 2, in <module>
from SimPy.Simulation import *
ImportError: No module named SimPy.Simulation
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
Refer point 4 of:
http://pythonhosted.org/SimPy/Manuals/INSTALLATION.html
for a workaround. It worked for me.
simpy package does not seem to have same classes as SimPy by using pip install SimPy command, simpy gets installed.
Hence, just download the SimPy package from the link and copy it to your classpath for python.
There is nothing wrong with your Python installation. SimPy 1 and SimPy 2 use remarkably different syntax from SimPy 3, which is the version that you have installed - and the one which is widely available. The old tutorials are all written in view of the old SimPy versions. Checkout this page...
http://simpy.readthedocs.org/en/latest/simpy_intro/installation.html
Related
I am trying to learn how to use pymem in Python.
I have tried to make two different programs according to two tutorials I have seen but I always get the same error when I try to run the code.
I have this:
from pymem import Pymem
pm = pymem("ac_client.exe")
health = pm.read_int(0x007B43F4)
print ("Health: ", health)
But when I try to run the code I get the following error:
Traceback (most recent call last):
File "c:\Users\N\Desktop\PYTHON\pymem\pymem2.py", line 1, in <module>
from pymem import Pymem
File "c:\Users\N\Desktop\PYTHON\pymem\pymem.py", line 4, in <module>
from pymem.process import *
ModuleNotFoundError: No module named 'pymem.process'; 'pymem' is not a package
I have pymem installed in it's latest version from Visual Studio Code. And in the videos I've seen (one is from a few months ago) they have the same code as me.
You have a file named pymem.py that's mentioned in the exception message (specifically c:\Users\N\Desktop\PYTHON\pymem\pymem.py). This locally written pymem module is shadowing the pymem package you've installed elsewhere (python\python310\lib\site-packages according to one of your comments, though that path is not complete).
You need to rename your pymem.py file to something else if you want to be able to use the package.
I think you don't have it installed, try going into cmd, Terminal or whatever and type pip install pymem.
pip should install the package for you and you should be good.
I am trying to install py2neo module but ending with below error. Please help me to resolve it.
(base) C:\Users\ADMIN>pip install py2neo Collecting py2neo Using cached https://files.pythonhosted.org/packages/cd/79/a77cc0ad86c021c25dac9f52a0cd33f6832c6af7fa5e58f4438d781ae9c3/py2neo-4.0.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\admin\appdata\local\temp\pip-install-xj8t67\py2neo\setup.py", line 25, in <module>
from py2neo.meta import __author__, __email__, __license__, __package__, __version__
File "py2neo\__init__.py", line 19, in <module>
from py2neo.data import *
File "py2neo\data.py", line 26, in <module>
from py2neo.cypher import LabelSetView, cypher_repr, cypher_str
File "py2neo\cypher\__init__.py", line 36, in <module>
from py2neo.internal.collections import SetView
File "py2neo\internal\collections.py", line 24, in <module>
from py2neo.internal.compat import bytes_types, string_types
File "py2neo\internal\compat.py", line 45, in <module>
DEVNULL = open(devnull, "rw")
ValueError: Invalid mode ('rw')
Command "python setup.py egg_info" failed with error code 1 in c:\users\admin\appdata\local\temp\pip-install-xj8t67\py2neo\
I tried to upgrade setuptools and pip too but didn't able to install py2neo after that also.
My python version is 2.7 and working on win 10 OS.
try this as well :
This is the basic requirements :
Python 2.7 / 3.4 / 3.5 / 3.6 / 3.7
Neo4j 3.2 / 3.3 / 3.4 / 3.5 (the latest point release of each version is recommended)
pip install git+https://github.com/technige/py2neo.git#egg=py2neo
This is a bug in the library. It is illegal to open a file with mode "rw", and they're clearly doing it. You can see the code here. It should almost certainly be using "r+" here.
It's worth noting that this piece of code only runs on old versions of Python, before subprocess.DEVNULL was added in 3.3. While 2.7 is still listed as officially supported, it seems to be in "legacy mode", with a bunch of "compat" code that tries to make 2.7 act like 3.3+, including this line, and some of that compat code is probably not heavily tested.
Also, this piece of code may only be needed on Windows. If so, as the README says:
Note also that Py2neo is developed and tested under Linux using standard CPython distributions. While other operating systems and Python distributions may work, support for these is not available.
So, the fact that their 2.7 compat code is broken on a platform they don't support isn't all that surprising…
What can you do about it?
Try running Python 3.7 or 3.6 instead of 2.7. That will definitely eliminate this problem, and possibly others that you haven't run into yet.
Run a linux VM (/container/user-mode kernel/whatever), and install Python (ideally 3.7) and py2neo under linux. This will definitely eliminate this problem, and possibly others.
Fix the bug yourself and submit a pull request.
File a bug report and wait and see if someone fixes it.
I am trying to import the paraview.simple module from Paraview 5.2 into the new Python 3.6.2 using IDLE. Unfortunately it appears this module is using the old print statement as suggested by this error message:
>>> import paraview.simple
Traceback (most recent call last):
File "<pyshell#50>", line 1, in <module>
import paraview.simple
File "C:\Program Files\ParaView 5.0.1\lib\paraview-5.0\site-packages\paraview\__init__.py", line 129
print text
^
SyntaxError: Missing parentheses in call to 'print'
I really want to use this version of python? There are other modules I wish to use alongside paraview.simple which are only compatible with the latest version of python. How can I circumvent this minor print issue and import the modules I need?
It seems like the question might not be relevant anymore since paraview hasn't been supported for long time (at least there haven't been any pull requests since 2017 https://github.com/Kitware/ParaView/pulls).
For those who still want to use it there is a solution as pointed by #Shashank in the comments: just convert it from python2 to python3 using 2to3 or similar tool.
I previously had Python 2.7 installed and was making calls like this:
api = jsonrpclib.Server('my host')
api.someFunctionCall()
I then upgraded to Python 3.5.2 and now when I run the code above, I'm receiving this message:
Traceback (most recent call last):
File "C:\login\login.py", line 1, in <module>
import jsonrpclib
File "C:\Python3.5.2\lib\site-packages\jsonrpclib\__init__.py", line 5, in <module>
from jsonrpclib.jsonrpc import Server, MultiCall, Fault
ImportError: No module named 'xmlrpclib'
I checked my installation and I do indeed have the xmlrpc lib:
c:\Python3.5.2\Lib\xmlrpc
What am I doing wrong?
Python 3.x has relocated the xmlrpclib module. Per the Python 2.7 xmlrpclib documentation:
"The xmlrpclib module has been renamed to xmlrpc.client in Python 3. The 2to3 tool will automatically adapt imports when converting your sources to Python 3."
It looks like the author of jsonrpclib has an open issue for Python 3 support, but hasn't responded or taken pull requests in a year. You may want to give the jsonrpclib-pelix fork a look for Python 3 support.
I recently installed Python 3.4.1 on Windows 8 and ran a code which gave me the error below. What steps should I follow to get rid of this error? Is there a link to install the mentioned module 'internals'? Its basically referring to a line of code in the module NLTK which I have imported in my code.
Error :
Traceback (most recent call last):
File "C:\Program Files (x86)\user\project\abc\abc\xyz.py", line 9, in <module>
import nltk
File "C:\Python34\lib\site-packages\nltk\__init__.py", line 91, in <module>
from internals import config_java
ImportError: No module named 'internals'
Update: NLTK 3.0.0b1 was released on July 11th, 2014 (two days after this question, go figure), adding support for Python 3.2 and up.
My original answer follows:
NLTK does not yet support Python 3:
NLTK requires Python versions 2.6-2.7.
You can download an alpha release at http://www.nltk.org/nltk3-alpha/
The import expects to find internals relative to the ntlk package, but Python 3 removed support for such (ambiguous) relative imports. Most likely, this will not be the only problem when running NLTK (other that the 3.0 alpha release) under Python 3.