Apotygma
Apotygma

Reputation: 81

Editable module ModuleNotFoundError even if installed and running with python in command window

I am going completely mental as I fail to understand and keep my python environment running.

So :

name: DLL_ETL
channels:
  - conda-forge
  - msys2
  - defaults
dependencies:
  - pandas
  - numpy

  - pip:
    - -e .
    - datatable

However, since today this is what I see :

Error messages

What am I doing wrong?

What I tried :

As can be understood :

Python path

Upvotes: 3

Views: 1672

Answers (2)

Apotygma
Apotygma

Reputation: 81

I managed to find the solution, but no idea why. I found a comment somewhere (I believe : pip: module installed as editable not found) that there is an issue in how some files are created when installing as editable.

More specifically, when installing as editable, two files are created :

  • ___editable___dll_etl_1_0_0_finder.py
  • editable.dll_etl-1.0.0.pth

both in the environment

Miniconda3\envs\DLL_ETL\Lib\site-packages

When comparing two environments I have, I noticed that the .pth created in the one that broke was not formatted similarly, the .py didn't even exist. More specifically

The original file

Original

What it should look like enter image description here

When creating the files manually, everything seems to work fine. I haven't tried to update since. Likely it's an issue with setuptools if I understand correctly.

Upvotes: 1

JialeDu
JialeDu

Reputation: 9727

  • Restart the jupyter kernel.

    enter image description here

  • Add the path to the package above the import statement.

    import sys
    // path is the directory where the package is located, not the full path of the package
    sys.path.append("path/to/package")
    import dll_etl
    

Upvotes: -1

Related Questions