pip install py2neo failing - python

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.

Related

ImportError in bitbake

I want to make a Yocto image for my hardware (i.e. IMX8) according to this manual:
https://github.com/compulab-yokneam/meta-bsp-imx8mm/blob/iot-gate-imx8_r3.1/README.md
I installed python3, and python2 on my Linux (Ubuntu 22.04) that is run on on VMWare virtual machine.
I configure my python using update-alternatives and I can alter and check the Python version, and every thing is correct. But I encounter with the following message when I run the bitbakecommand:
Traceback (most recent call last):
File "/home/sap1359/compulab/sources/poky/bitbake/bin/bitbake", line 19, in <module>
import bb
File "/home/sap1359/compulab/sources/poky/bitbake/lib/bb/__init__.py", line 128, in <module>
from bb import fetch2 as fetch
File "/home/sap1359/compulab/sources/poky/bitbake/lib/bb/fetch2/__init__.py", line 26, in <module>
import bb.persist_data, bb.utils
File "/home/sap1359/compulab/sources/poky/bitbake/lib/bb/persist_data.py", line 22, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
When I try to track another tutorial for other hardware or even for a simple X86 Yocto image,there is something the same as this error cannot import name 'someting' from 'collections'.
I also tried using virtualenv and setting up an virtual environment, however, the Import error persist.
I checked using Ubuntu 18.04, everything was OK.
According to my tests, this Yocto project can't work with Python3.10 and above, however, works in Ubuntu 22.04 by installing another version of Python3 such as 3.8.
I just want to mention that this Yocto source just uses Python3.5, or above.

Import Error with pyFFTW (scipy.fftpack) in Python 3.8

I have a numerical simulation program that works fine at the institute I'm in, there I have a Win10 box where I installed Python 3.7.3 64-bit. I am trying to run the same program in my laptop with Manjaro and Python 3.8.1 (It was also 3.7.3 at the time I installed it, but rolling release ¬¬). The problem is that in my laptop I am getting the following error when trying to import pyFFTW
Traceback (most recent call last):
File "/home/User/Documents/Program.py", line 22, in <module>
import pyfftw # Pythonic wrapper for FFTW
File "/usr/lib/python3.8/site-packages/pyfftw/__init__.py", line 43, in <module>
from . import interfaces
File "/usr/lib/python3.8/site-packages/pyfftw/interfaces/__init__.py", line 237, in <module>
from . import scipy_fftpack
File "/usr/lib/python3.8/site-packages/pyfftw/interfaces/scipy_fftpack.py", line 65, in <module>
from scipy.fftpack import (dct, idct, dst, idst, diff, tilbert, itilbert,
ImportError: cannot import name '_fftpack' from 'scipy.fftpack' (/usr/lib/python3.8/site-packages/scipy/fftpack/__init__.py)
Process finished with exit code 1
As far as I can tell the problem is arising from the libraries within the pyFFTW package itself, but I have no idea how to fix it. I tried uninstalling and reinstalling both pyFFTW (1.17.4) and scipy (1.4.1) with little success.
I thought that I could install another version on Python in my Manjaro box and simply "match" all the versions of the packages in the Win box, but I'm looking for a less nuclear solution.
Just for completeness sake, MWE:
$ python
>>> import pyfftw
This is fixed in master. A release should be made shortly. You can either wait for that or pull from github.
Edit: Release made that fixes this on Feb 3 2020.

rpy2 3.2.0 on python 3.7 issues w/ importing robjects

python 3.7.3, rpy2 3.2.0, the following code:
from rpy2 import robjects
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/robjects/__init__.py", line 14, in <module>
import rpy2.rinterface as rinterface
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/rinterface.py", line 6, in <module>
from rpy2.rinterface_lib import openrlib
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py", line 65, in <module>
_get_dataptr_fallback)
File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py", line 50, in _get_symbol_or_fallback
res = getattr(rlib, symbol)
RuntimeError: found a situation in which we try to build a type recursively. This is known to occur e.g. in ``struct s { void(*callable)(struct s); }''. Please report if you get this error and really need support for your case.
What's going on? This looks like standard procedure for rypy2, and indeed how we used it under python 2.
Same issue applies for any kind of rpy2 import: import rpy2.robjects.tests etc.
I ran into the same problem and found the same issue #ejolly linked above. To get around it, I downgraded my cffi library from 1.13.0 to 1.12.3.
pip install cffi==1.12.3
Worked like a charm.
edit:cffi 1.13.1 is released. Just update it and all should work.
The issue appeared with cffi 1.13.0, but appears limited to the ABI mode.
rpy2 will try to use the API mode, but if it fails will silently fall back to the ABI mode. If your system can be configured to have a C compiler, the API mode should be installed. To force the use of the API mode, set the environment variable:
RPY2_CFFI_MODE=API
(see info box in the doc:
https://rpy2.github.io/doc/v3.2.x/html/overview.html#install-from-source)

installing mysql for python 2.7

D:\PythonPack\MySQL-python-1.2.3>python setup.py install
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "D:\PythonPack\MySQL-python-1.2.3\setup_windows.py", line 7, in get_confi
g
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_ke
y'])
WindowsError: [Error 2] The system cannot find the file specified
I am trying to install mysqldb for python in windows7 and run into that error message
Do you have an idea how I can make it work ? I already have pythonsetuptool installed
Actually there are many ways and i tried them for few hours and realize its time waste process bcoz MYSQLdb is vary from version to version i.e 2.6,2.7 and 3.2 but all those are confuse and time waste processes,
Instead best way is to get precompiled executables from : http://www.lfd.uci.edu/~gohlke/pythonlibs .
here choose version wise links like python 2.7 and 32bit so that you won't get any errors and now run the downloaded file, finally set path in environment variables.
Now open python IDLE editor or from command prompt c:>python
import MySQLdb
if u don't get any errors then it's working fine...enjoy with u r work
Just install with the exe from here.
And maybe you can find more information about this in the previous asked questions like this.

What is wrong with this SimPy installation?

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

Categories