pypy no module named dateutil - python

I'm trying to import dateutil in pypy, which I've got the following error. Importing dateutil in python2.7 didn't return an error
[root#]# python
Python 2.7.5 (default, May 31 2018, 09:41:32)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dateutil
>>> exit()
[root#]# pypy
Python 2.7.13 (4a68d8d3d2fc1faec2e83bcb4d28559099092574, Oct 18 2019, 01:09:48)
[PyPy 7.2.0 with GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import dateutil
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named dateutil
I'm not sure if this is related but dateutil is found in
/usr/lib/python2.7/site-packages
But not found in
/usr/lib64/python2.7/site-packages
pypy on the server is located in
/opt/pypy-7.2.0-linux_x86_64-portable
I tried uninstalling dateutil and reinstalling dateutil using pip, but pypy can't seem to find it.
Would appreciate any help. Thank you in advance!!!

You might be using the wrong pip. When you call pip install ... you will find whichever pip is first on your $PATH, which may not be the one you need. I try to use path/to/pypy -mpip install ... which will ensure you are using the correct one

Related

Running “import tensorflow” on Mac generates "No module named tensorflow" error

Actually I already installed tensorflow by using
$ pip install tensorflow
and it works well when I use
$ python
Python 2.7.15 (default, Jul 23 2018, 21:27:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>import tensorflow
>>>
but when I use python3 on command line
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>
it shows an error, and it shows the same error when I use IDLE
use
pip3 install tensorflow
pip installs to default python directory. pip3 installs to python3

Cannot get psycopg2 to work, but installed correctly. Mac OS

I'm trying to work with psycopg2 natively on Mac. It installs fine, with no errors at least, but when i import it get an error message.
I've seen dozens of threads with similar issues and solutions that vary massively and just seem excessive for such a common module.
can anyone help?
Last login: Wed Oct 12 15:47:24 on console
Gurmokhs-MBP:~ Gurmokh$ pip install psycopg2
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /Library/Python/2.7/site-packages
Gurmokhs-MBP:~ Gurmokh$ python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 12:54:16)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/psycopg2-2.6.2-py2.7-macosx-10.6-intel.egg/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site -packages/psycopg2-2.6.2-py2.7-macosx-10.6- intel.egg/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/psycopg2-2.6.2-py2.7-macosx-10.6-intel.egg/psycopg2/_psycopg.so
Reason: image not found
>>> ^D
Gurmokhs-MBP:~ Gurmokh$
I can see some copies floating round from different applications.
I'm assuming i could copy one of these. The above message tells me what is referencing this file, but they do not tell me where they expect to find it. If i knew where it should go i would try this.
bash-3.2# find . -name "libssl.1.0.0.dylib"
./Library/Application Support/Fitbit Connect/libssl.1.0.0.dylib
./Library/PostgreSQL/9.5/lib/libssl.1.0.0.dylib
./Library/PostgreSQL/9.5/pgAdmin3.app/Contents/Frameworks/libssl.1.0.0.dylib
./Users/Gurmokh/.Trash/Navicat for PostgreSQL.app/Contents/Frameworks/libssl.1.0.0.dylib
Thanks guys.
#maxymoo I went with your suggestion. I have installed anaconda2. The install updated my path to include /anaconda/bin.
Then using the navigator I installed pyscopg2. Now I am able to use this in the shebang and my scripts execute fine and i'm able to import this module.
Gurmokhs-MBP:rest Gurmokh$ python
Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import psycopg2
if psycopg2.connect("dbname='postgres' user='postgres' host='localhost'"):
... print "connection made"
...
connection made
>>>

Python version confusion + cairo

I have python installed in two locations, in os default it's 2.6.6 and in /usr/local/bin/python2.7 has 2.7.
I have installed cairo (cairo-1.12.18) via source using configure/make/make install, but it appears to have installed under python 2.6.6. How do I install it for python2.7?
[root#xxxxx ~]# python
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>>
[root#xxxxx ~]# /usr/local/bin/python2.7
Python 2.7.8 (default, Nov 18 2014, 11:15:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cairo
>>>
Thank you.
Be sure to install it using python 2.7 and not python 2.6 (run make and make install using python 2.7). I assume you use Linux OS so your default Python is 2.7, you can change your default Python but it's not recommended due to several reasons. Please look at this StackOverflow question and answers for more informations:
Two versions of python on linux. how to make 2.7 the default

Import Numpypy when using pypy2.2

I used to have pypy verion 1.9. I could do the following to import numpypy:
>pypy
Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:42:54)
[PyPy 1.9.0 with GCC 4.2.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``translating pypy with cpython is
soooooo slow''
>>>> import numpypy
Recently I updated my os and installed pypy Version 2.2 now I am not able to import numpypy
>>>> import numpypy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpypy
What could be the issue? I know numpy is not fully supported, but I have many scripts that use the limited functionality of numpypy in pypy.
See the third bullet here: http://doc.pypy.org/en/latest/release-2.2.0.html#highlights
~$ pypy
Python 2.7.3 (87aa9de10f9c, Nov 24 2013, 20:57:21)
[PyPy 2.2.1 with GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``pypy is a race between people
shaving yaks and the universe producing more bearded yaks. So far, the universe
is winning''
>>>> import _numpypy
>>>> _numpypy.multiarray.array([5,3,2])
array([5, 3, 2])

Python, Ubuntu: Install PyPi package for a specific Python version

I've installed Python 3.3 alongside Python 2.75 on my Ubuntu machine. The problem is that easy_install gets packages for the default, 2.75 version only, e.g:
easy_install pymongo
$ python
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>>
But:
$ python3.3
Python 3.3.1 (default, Apr 17 2013, 22:30:32)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pymongo'
How can I install PyPi packages for the Python 3.3 installation?
You need easy_install3. In apt-get you get it by
apt-get install python3-setuptools

Categories