Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: DLL load failed while importing _cext: The specified module could not be found. #40

Closed
PimWagemans09 opened this issue May 24, 2024 · 13 comments

Comments

@PimWagemans09
Copy link

PimWagemans09 commented May 24, 2024

Hello its me again it seems im am cursed or something
i tried installing ctk theme builder on another laptop and ran into a problem again (a different one though)
it installs just fine but when trying to run te program i get this Exception:

PS C:\Users\58147793\ctk_theme_builder> ./ctk_theme_builder
Traceback (most recent call last):
  File "C:\Users\58147793\ctk_theme_builder\\controller\ctk_theme_builder.py", line 10, in <module>
    from view.control_panel import ControlPanel
  File "C:\Users\58147793\ctk_theme_builder\view\control_panel.py", line 5, in <module>
    import utils.cbtk_kit as cbtk
  File "C:\Users\58147793\ctk_theme_builder\utils\cbtk_kit.py", line 12, in <module>
    from matplotlib.colors import is_color_like
  File "C:\Users\58147793\ctk_theme_builder\venv\Lib\site-packages\matplotlib\__init__.py", line 272, in <module>
    _check_versions()
  File "C:\Users\58147793\ctk_theme_builder\venv\Lib\site-packages\matplotlib\__init__.py", line 266, in _check_versions
    module = importlib.import_module(modname)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\58147793\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\58147793\ctk_theme_builder\venv\Lib\site-packages\kiwisolver\__init__.py", line 8, in <module>
    from ._cext import (
ImportError: DLL load failed while importing _cext: The specified module could not be found.
PS C:\Users\58147793\ctk_theme_builder> ./venv/Scripts/activate
(venv) PS C:\Users\58147793\ctk_theme_builder> python --version
Python 3.12.3

i tried the solution from this stackoverflow answer (pip install msvc-runtime) but then i got the error:

ERROR: Could not find a version that satisfies the requirement msvc-runtime (from versions: none)
ERROR: No matching distribution found for msvc-runtime

theme builder setup log
theme_builder_setup_2024-05-24_21-05-42.log

python 3.12.3
windows 10 education
ctk_theme_builder 3.1.0

@avalon60
Copy link
Owner

avalon60 commented May 25, 2024

Hello @PimWagemans09. When you did the pip Install, did you source the virtual environment first?
venv\scripts\activate.bat

Also, where did you install (source) Python from?

@PimWagemans09
Copy link
Author

I did activate the venv before running pip and i installed the current latest version for windows from python.org

@PimWagemans09
Copy link
Author

PimWagemans09 commented May 25, 2024

i just noticed the venv pip version is 24.0 evethough the version in get-pip.py is 22.3.1 i have not run pip install --upgrade pip
is this intentional?

PS C:\Users\58147793\ctk_theme_builder> ./venv/scripts/activate
(venv) PS C:\Users\58147793\ctk_theme_builder> pip --version
pip 24.0 from C:\Users\58147793\ctk_theme_builder\venv\Lib\site-packages\pip (python 3.12)

also i now get a warning that i previously didnt when running theme_builder_setup.py:

Checking Python interpreter version...
WARNING: Python interpreter version, 3.12.3, is unsupported.
         Only Python versions between 3.8.0 and 3.11.99 are fully supported

this is weird as the documentation says 3.12 is supported

@avalon60
Copy link
Owner

avalon60 commented May 25, 2024

The get-pip.py isn't intentional, and you can try upgrading pip.

Don't worry about the warning, it's a benign bug. 3.12 is actually supported.

I may struggle to reproduce & investigate this, as I only have Windows 11 these days.

@avalon60
Copy link
Owner

avalon60 commented May 26, 2024

Maybe some of the suggestions here might help.

@PimWagemans09
Copy link
Author

i tried reinstalling all the libraries is the venv as i didnt know wich one was causing the issue (and cleared the pip cache)
but that didnt help

and i checked the enviroment variables which seem to be configured correctly including sys.path in the venv:

sys.path = [
    'C:\\Users\\58147793\\ctk_theme_builder',
    'C:\\Users\\58147793\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip',
    'C:\\Users\\58147793\\AppData\\Local\\Programs\\Python\\Python312\\DLLs',
    'C:\\Users\\58147793\\AppData\\Local\\Programs\\Python\\Python312\\Lib',
    'C:\\Users\\58147793\\AppData\\Local\\Programs\\Python\\Python312',
    'C:\\Users\\58147793\\ctk_theme_builder\\venv',
    'C:\\Users\\58147793\\ctk_theme_builder\\venv\\Lib\\site-packages',
]
USER_BASE: 'C:\\Users\\58147793\\AppData\\Roaming\\Python' (doesn't exist)
USER_SITE: 'C:\\Users\\58147793\\AppData\\Roaming\\Python\\Python312\\site-packages' (doesn't exist)
ENABLE_USER_SITE: False

@PimWagemans09
Copy link
Author

i also tried installing the visual studio c++ redistributables as mentioned here which didnt work and manually installing mvsc-runtime from a .whl file wich also didnt work due to the error:

ERROR: msvc_runtime-14.34.31931-pp38-pypy38_pp73-win_amd64.whl is not a supported wheel on this platform.

all other .whl files on pypi say they're for python 3.11 so i have not tried installing them

@PimWagemans09
Copy link
Author

running the progam outside the venv (and installing the required packages) didnt work either

@avalon60
Copy link
Owner

I can't say that I am surprised. The problem seems to be caused by an indirect dependency.

@PimWagemans09
Copy link
Author

PimWagemans09 commented May 27, 2024

i tried from matplotlib.colors import is_color_like in the shell outside the venv as that module seems to be the problem and that worked just fine so its something in the venv

@PimWagemans09
Copy link
Author

PimWagemans09 commented May 27, 2024

i tried importing matplotlib inside a manually recreated venv and that also caused the error so its something with matplotlib in the venv

matplot lib stopped working completely on my system inside or outside of a venv

@PimWagemans09
Copy link
Author

PimWagemans09 commented May 27, 2024

i figured it out the fix was installing the visual studio redistributables but i made a mistake and downloaded the wrong version and didnt care to double check
sorry the inconvenience

@avalon60
Copy link
Owner

No problem; pleased it's sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants