mypyc icon indicating copy to clipboard operation
mypyc copied to clipboard

error: could not create '__init__.cp39-win_amd64.pyd': No such file or directory

Open Avasam opened this issue 2 years ago • 3 comments

Reopening #918

I am trying to compile an entire src/ directory at once. That directory is the root of python code. Running mypyc src/ eventually results in :

[...]
Generating code
Finished generating code
copying build\lib.win-amd64-cpython-39\b2c16f670913ff40c51c__mypyc.cp39-win_amd64.pyd -> 
copying build\lib.win-amd64-cpython-39\capture_method\__init__.cp39-win_amd64.pyd -> capture_method
error: could not create 'capture_method\__init__.cp39-win_amd64.pyd': No such file or directory

So instead I try to cd src/ followed by mypyc . --config-file=../mypy.ini which seems to work (compiled w/o errors, although I'm sure I have more runtime issues to go through), but I run into https://github.com/mypyc/mypyc/issues/1008

Source code for reference: https://github.com/Toufool/AutoSplit/tree/mypyc-attempt

Avasam avatar Jul 11 '23 00:07 Avasam

I suspect this is still an issue, but not sure. A short self-contained repro would be helpful. We should make this work or at least generate an error and provide some hint about what should be done.

JukkaL avatar Feb 03 '25 18:02 JukkaL

Cloning the branch I shared and running mypyc src/ in the root should serve as a reproduction. I guess you'd need to install type dependencies too. I'll work on providing a minimal reproduction.

Avasam avatar Feb 04 '25 04:02 Avasam

The following file structure will result in the error.

.
└── src/
    └── package/
        ├── __init__.py
        └── eggs.py
mypyc src/package

The error happens when src does not contain an __init__.py file (though it may contain python files). mypyc tries to copy the compiled modules of package into package/ (instead of src/package/), which might not exist.

Depending on what files are in package, it may either fail to copy, or copy files to . when they should be placed in src

aatle avatar Feb 23 '25 03:02 aatle