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

In standalone python script from qgis._core import * produces ImportError: DLL load failed: The specified module could not be found #23957

Closed
qgib opened this issue Jan 5, 2017 · 2 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins

Comments

@qgib
Copy link
Contributor

qgib commented Jan 5, 2017

Author Name: Raphael Dumas (@radumas)
Original Redmine Issue: 16042
Affected QGIS version: 2.14.9
Redmine category:python_plugins


In Windows 7 x64 SP1 using Python 2.7 x64, I installed QGIS 2.14.9 from the standalone x64 installer. I was trying to set up a python virtual environment to develop standalone app (http://gis.stackexchange.com/a/223325/36886). I added the following paths to a @.pth@ file in the environment's site-packages:

C:\\Program Files\\QGIS Essen\\apps\\qgis-ltr\\python
C:\\Program Files\\QGIS Essen\\apps\\Python27\\
C:\\Program Files\\QGIS Essen\\apps\\Python27\\Lib\\
C:\\Program Files\\QGIS Essen\\apps\\Python27\\Lib\\site-packages
C:\\Program Files\\QGIS Essen\\bin
C:\\Program Files\\QGIS Essen\\include
C:\\Program Files\\QGIS Essen\\apps\\qgis-ltr\\bin

But when I type @from qgis.core import *@, python tries to import @qgis._core@ and fails with

ImportError: DLL load failed: The specified module could not be found

Having a look at the @qgis/_core.pyd@ file with DependencyWalker produces the attached output image


@qgib
Copy link
Contributor Author

qgib commented Jan 5, 2017

Author Name: Raphael Dumas (@radumas)


Sorry, fired off this issue a little prematurely.

I resolved the import error by adding the following to my PATH variable.

C:\\Program Files\\QGIS Essen\\apps\\qgis-ltr\\bin
C:\\Program Files\\QGIS Essen\\bin

Though I would highlight that just adding @C:\Program Files\QGIS Essen@, as the documentation suggested, didn't work. http://docs.qgis.org/2.14/en/docs/pyqgis_developer_cookbook/intro.html#running-custom-applications

@qgib
Copy link
Contributor Author

qgib commented Jan 10, 2017

Author Name: Matthias Kuhn (@m-kuhn)


Thanks for posting this followup.

Would you mind improving the description in the cookbook?

It should be trivial to create a improvement proposal (pull request) using the online editor here:
https://github.com/qgis/QGIS-Documentation/blob/master/source/docs/pyqgis_developer_cookbook/intro.rst

Thank you in advance!


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins Crash/Data Corruption labels May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins
Projects
None yet
Development

No branches or pull requests

1 participant