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

Import issue on SOME Windows systems #298

Closed
wallace11 opened this issue Oct 31, 2020 · 33 comments
Closed

Import issue on SOME Windows systems #298

wallace11 opened this issue Oct 31, 2020 · 33 comments
Labels
platform: Windows Windows specific issue

Comments

@wallace11
Copy link
Contributor

wallace11 commented Oct 31, 2020

Version of Dear PyGui: Latest (Tested on 0.4.0 and others as well)

Operating System: Windows 8/10

My Issue/Question

Lately I was asked by colleagues who use Windows to share with them the app I was developing using this DPG.
I packaged the app for them and some reported that it didn't work, while others had no issue whatsoever. Some were running Windows 8 and others Windows 10.
Long story short, after hours of trying to figure this out I grabbed a computer I had lying around and fired up Windows on it. It didn't work on it so I installed Python 3.7.9 and DPG.
Simply running the Python console I got the following error:

>>> import dearpygui.core
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

Bingo!

The main culprit was DX11 so I ran dxdiag but all seemed correct and all DX features were enabled.

This might be a bug of the main lib, but since I used DPG I thought I'd go here first.
Also, @hoffstadt is an awesome maintainer :)

@wallace11 wallace11 changed the title Import issue on SOME w Import issue on SOME Windows systems Oct 31, 2020
@hoffstadt
Copy link
Owner

I appreciate the complement! I’m away from my computer for the day but I will look into this tomorrow. My first thought is that the drivers for DirectX 11 are not up to date (that is our only dependency one windows).

These are all 64 bit pythons?

@wallace11
Copy link
Contributor Author

Your responses are getting faster and faster ;)

For all the systems besides the local one I tested I used a packaged app exe (using pyinstaller). That's why it was hard for me to debug this since I don't have direct access to those machines, and I'm not entirely sure what their specs are. I'm guessing most if not all of them are running a 64 bit OS.

The local machine I've got here is running a 64 bit OS and a 64 bit version of Python.
I just finished all the routine updates after a Windows installation (which took half a day, btw 😠) and problem still persists.
DX version reported is 12, actually.
On my gf's machine the exe file runs just fine (hence, DPG works).

I am puzzled by this.

@Dynamith
Copy link

Dynamith commented Nov 1, 2020

I have the same error, my DX is version 12 and my windows and python are 64 bits.

@hoffstadt
Copy link
Owner

Looking into this!

@hoffstadt
Copy link
Owner

hoffstadt commented Nov 2, 2020

I suspect it could be these DLLs. Can you confirm whether they are present (or missing) on the broken system?

image

@hoffstadt hoffstadt added the bug label Nov 2, 2020
@Dynamith
Copy link

Dynamith commented Nov 2, 2020

They are both present.
image

@hoffstadt
Copy link
Owner

This is on the broken system? How about these:

image

@Dynamith
Copy link

Dynamith commented Nov 2, 2020

Yes, it is on the broken system. And the python38.dll and xinput1_4.dll are also present.

@hoffstadt
Copy link
Owner

Sorry, I meant all of these ha.

@wallace11
Copy link
Contributor Author

Here I've got all DLLs mentioned above

@hoffstadt
Copy link
Owner

hoffstadt commented Nov 2, 2020

Hmm. Well I am stumped. I am unable to reproduce the issue on any of our machines.

This issue typically is either:

  1. Environment Setup
  2. Naming the module dearpygui.py
  3. Installing the venv and testing outside of it
  4. Installing globally and testing inside a venv

I don't have enough information to trace down the issue.

@wallace11
Copy link
Contributor Author

Sorry, I'm not sure I understood your question.
I've tried installing it using pip both in a virtual environment and system-wide

@wallace11
Copy link
Contributor Author

I'll try to gather more information...

@hoffstadt
Copy link
Owner

hoffstadt commented Nov 2, 2020

On the same command line you showed the issue, what does this reply with?

pip show dearpygui
pip list

@wallace11
Copy link
Contributor Author

PS C:\Windows\System32> pip show dearpygui
Name: dearpygui
Version: 0.5.53
Summary: DearPyGui: A simple Python GUI Toolkit
Home-page: https://github.com/hoffstadt/DearPyGui
Author: Jonathan Hoffstadt and Preston Cothren
Author-email: jonathanhoffstadt@yahoo.com
License: MIT
Location: c:\users\11wal\appdata\local\programs\python\python37\lib\site-packages
Requires:
Required-by:
PS C:\Windows\System32> pip list
Package                   Version
------------------------- ----------
altgraph                  0.17
dateparser                1.0.0
dearpygui                 0.5.53
future                    0.18.2
numpy                     1.19.3
pandas                    1.1.4
pefile                    2019.4.18
pip                       20.1.1
pyinstaller               4.0
pyinstaller-hooks-contrib 2020.10
python-dateutil           2.8.1
pytz                      2020.1
pywin32-ctypes            0.2.0
regex                     2020.10.28
setuptools                47.1.0
six                       1.15.0
tzlocal                   2.1

@hoffstadt
Copy link
Owner

could you also show pip debug

@hoffstadt
Copy link
Owner

And from that same command line you can't run python and import it?

@wallace11
Copy link
Contributor Author

I'm constantly trying things and couldn't succeed in importing this library on that machine...
Be sure that I'll let you know right away if it worked ;)

> pip debug --verbose
WARNING: This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.
pip version: pip 20.1.1 from c:\users\11wal\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
sys.version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
sys.executable: c:\users\11wal\appdata\local\programs\python\python37\python.exe
sys.getdefaultencoding: utf-8
sys.getfilesystemencoding: utf-8
locale.getpreferredencoding: cp1252
sys.platform: win32
sys.implementation:
  name: cpython
'cert' config value: Not specified
REQUESTS_CA_BUNDLE: None
CURL_CA_BUNDLE: None
pip._vendor.certifi.where(): c:\users\11wal\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\certifi\cacert.pem
pip._vendor.DEBUNDLED: False
vendored library versions:
  appdirs==1.4.3
  CacheControl==0.12.6
  colorama==0.4.3
  contextlib2==0.6.0.post1 (Unable to locate actual module version, using vendor.txt specified version)
  distlib==0.3.0
  distro==1.5.0 (Unable to locate actual module version, using vendor.txt specified version)
  html5lib==1.0.1
  ipaddress==1.0.23
  msgpack==1.0.0 (Unable to locate actual module version, using vendor.txt specified version)
  packaging==20.3
  pep517==0.8.2
  progress==1.5
  pyparsing==2.4.7
  requests==2.23.0
  certifi==2020.04.05.1
  chardet==3.0.4
  idna==2.9
  urllib3==1.25.8
  resolvelib==0.3.0
  retrying==1.3.3 (Unable to locate actual module version, using vendor.txt specified version)
  setuptools==44.0.0 (Unable to locate actual module version, using vendor.txt specified version)
  six==1.14.0
  toml==0.10.0
  webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
Compatible tags: 27
  cp37-cp37m-win_amd64
  cp37-abi3-win_amd64
  cp37-none-win_amd64
  cp36-abi3-win_amd64
  cp35-abi3-win_amd64
  cp34-abi3-win_amd64
  cp33-abi3-win_amd64
  cp32-abi3-win_amd64
  py37-none-win_amd64
  py3-none-win_amd64
  py36-none-win_amd64
  py35-none-win_amd64
  py34-none-win_amd64
  py33-none-win_amd64
  py32-none-win_amd64
  py31-none-win_amd64
  py30-none-win_amd64
  cp37-none-any
  py37-none-any
  py3-none-any
  py36-none-any
  py35-none-any
  py34-none-any
  py33-none-any
  py32-none-any
  py31-none-any
  py30-none-any

@wallace11
Copy link
Contributor Author

The Windows machine on which dpg works, and where I did all the tests is currently offline.

I'm looking at appdata\local\programs\python\python37\dlls on the "bad" machine - are there any special dlls that should be there, maybe?

@hoffstadt
Copy link
Owner

Nope. Everything DPG needs is on the list above and that's it! Can you mail the broken machine? lol

@Dynamith
Copy link

Dynamith commented Nov 3, 2020

My dpg can run. I found that MSVCP140 is not in systme32, but in a folder like C:\Windows\System32\DriverStore\FileRepository\iclsclient.inf_amd64_75ffca5eec865b4b\lib. And it can run after I repair.
image

@wallace11
Copy link
Contributor Author

I've got msvcp140 on system32 root, and looking closely I noticed there are msvcp110 & msvcp120 as well.
I'm still unable to load dpg on that machine.

@hoffstadt It'd be difficult to mail the machine over, but we may be able to schedule a remote session where you'll be able to fully access the machine. Feel free to reach over by email for that.

@AltoRetrato
Copy link

Have you tried running Python in verbose mode?

E.g., save this into the file test.py:

from dearpygui.core import *
from dearpygui.simple import *

Then run from the command prompt: python -vv test.py 2> output.txt

The 2> part redirects stderr to the output.txt file, which should contain a lot of details about how Python is trying to import modules (1.474 lines on my PC). That might give you some more insight into the problem.

@wallace11
Copy link
Contributor Author

Thanks for providing yet another interesting direction.
I tried analyzing the results but I'm not sure what to make of it... This core.pyd is a complete black box and it's unclear what DLLs it was trying to access...
Here's the debug log as a file and as a termbin link:
https://termbin.com/95vb
debug.txt

@hoffstadt
Copy link
Owner

Looking through the debug file now.

Btw core.pyd only links to d3d11 and python

@hoffstadt hoffstadt added the platform: Windows Windows specific issue label Nov 6, 2020
@hoffstadt
Copy link
Owner

Worst comes to worst, we could do the remote session you mentioned and setup the development environment to try and debug it.

@AltoRetrato
Copy link

Worst comes to worst, we could do the remote session you mentioned and setup the development environment to try and debug it.

Alternatively, @wallace11 could run Process Monitor on the target machine to capture system data and send a log to you for analysis.

Clipboard01

@wallace11
Copy link
Contributor Author

Alright, good news! Thanks to @AltoRetrato's great suggestion, I was able to track down and fix the problem!
Here's the full process I followed:

  1. I filtered all python.exe processes and started monitoring in Process Monitor.
  2. Fired up Python console via Power Shell and ran import dearpygui.core.
  3. Filtered all Paths that start with C:\.
  4. Set highlight to lines containing "NAME NOT FOUND".
  5. Followed each one to make sure that each file was found eventually (there are multiple possible locations, so the first one may fail, which is fine).
  6. I noticed that a particular file vcruntime140_1.dll was never found, even though C:\Windows\System32\vcruntime140.dll did exist. (Simply duplicating and renaming the existing file didn't work)
  7. I arrived at this thread on StackOverflow.
  8. I installed vc_redist.x64.exe from https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads, which created the missing dll after a reboot.
  9. Success :)

So the conclusion is that this particular tool is actually a dependency without which DPG wouldn't run :)
Once this fix is confirmed (I'll have my colleagues install it and report back next week) I can create PR adding this to the readme (a note in the installation, I guess?).

TL;DR
Install vc_redist.x64.exe from https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

@hoffstadt
Copy link
Owner

Awesome!

@hoffstadt
Copy link
Owner

hoffstadt commented Nov 7, 2020

I actually mentioned those 2 DLLs a few messages up before sending the whole list of DLLs! You said they were both present! Lol

You also showed a picture of both present. Was that a different machine?

@wallace11
Copy link
Contributor Author

That is true!
I looked back at your message now and I remember seeing both of these DLLs on that "bad" machine. Should've taken a proof screenshot at that time 😆
I guess it was removed somewhere during my play with it and installing this Visual Cpp thingy brought it back and did other stuff as well that made it work. All speculation right now but I'll be able to confirm it next week.

@wallace11
Copy link
Contributor Author

Update:
It worked!
Will create a documentation PR in the upcoming weekend.

@hoffstadt
Copy link
Owner

Awesome! So this issue can be closed?

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

No branches or pull requests

4 participants