0

I have gotten cygwin up and running in windows, and everything seems to be working fine, except for loading python modules.

>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/requests/__init__.py", line 44, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

And then here is another error I got for numpy which looks a little different.

    >>> import numpy
Traceback (most recent call last):
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
ImportError: cannot import name 'multiarray'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/cygdrive/c/Users/mkupfer/appdata/local/programs/python/python36-32/lib/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray'

I initially thought that this had to do with my sys.path? But I've added the following to my .bashrc file and still having issues above:

PYTHONPATH="$HOME/appdata/local/programs/python/python36-32/lib/site-packages"
PYTHONPATH="${PYTHONPATH}:$HOME/appdata/local/programs/python/python36-32/lib"
export PYTHONPATH

I've tried the solution to another question here: https://stackoverflow.com/a/32027563/1656488, but that still didn't fix anything. It in fact installed pip3 under my windows user directory and not in cygwin.

Maxim
  • 725
  • 1
  • 8
  • 24
  • Take those lines *out* of your `.bashrc`. Your Cygwin Python is not the Python you're using outside of Cygwin. – user2357112 Nov 13 '18 at 21:31
  • Sure, but how do I properly use python in cygwin? Whenever I do pip install it already says I have the modules installed so there must be some link – Maxim Nov 14 '18 at 14:18

1 Answers1

0

I have solved my issue by following the steps in this answer. Thank you to @not2qubit for the eloquent solution. Please follow the link so that they may claim credit for this answer.

Maxim
  • 725
  • 1
  • 8
  • 24
  • On cygwin pip is provided by `python3-pip` or `python2-pip` depending on which python you are using. – matzeri Nov 14 '18 at 20:18
  • I see. In my case, using enusrepip seems to do the trick. Any reason why I should install and use cygwin's version instead? – Maxim Nov 14 '18 at 21:48
  • If you are using cygwin python it is better to use cygwin python packages if they are available. – matzeri Nov 15 '18 at 06:49