0

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!!!

  • `pip install --target=d:\somewhere\other\than\the\default package_name` as specified in the question https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip – nitin3685 Nov 07 '19 at 05:09
  • Does this answer your question? [Install a Python package into a different directory using pip?](https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip) – nitin3685 Nov 07 '19 at 05:09
  • 1
    ``dateutil`` is a third-party module. Why do you assume ``pypy`` should have it when ``python`` does? Did you install it for pypy? – MisterMiyagi Nov 07 '19 at 06:08

1 Answers1

0

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

mattip
  • 2,360
  • 1
  • 13
  • 13
  • This answer works for me thanks so much! A side note, had to add read and execute permission in the `/opt/pypy-7.2.0-linux_x86_64-portable/site-packages` dateutil folder for normal users to import the module. – quicksilver Nov 08 '19 at 06:42