ImportError: No module named Processing - python

ImportError: No module named Processing
I am using QGIS APIs for developing my application in Python. Eclipse is the IDE that I have been using for other projects. Now, I am trying to connect eclipse to the packages and libraries of QGIS but it is not going well.
the error I currently get is:
ImportError: No module named Processing
I have included all libraries, packages, DLLs and so on.
below you can see a snapshot of a piece of my code.
I have no idea how to fix it.
I have checked this configuration as well.
I also read almost all the related topics in the stackoverflow...I set the processing in my python path (both in the beginning and at the end)..
I have been restarting my system every time I changed the setting...
what is wrong!

To work with processing package, you should add it in a level higher than processing package like:
C:\OSGeo4W\apps\qgis\python\plugins
where processing is in plugins. then import processing will perfectly work.

Related

What does `ImportError: DLL load failed: The operating system cannot run %1` mean?

I have a project written in Python 3.9 and C++ 17, with pybind11 as the glue. It works just fine when running alone or through various debuggers, like VS's debugger and NVIDIA Nsight. However, when running through RenderDoc (a graphics API debugger, with it's own Python bindings which I don't use) I get the following error in the terminal:
ImportError: DLL load failed: The operating system cannot run %1
The error if given out for modules in my project trying to import modules from my project.
At first the error message feels similar to ImportError: DLL load failed: The specified module could not be found, so I investigated in Process Monitor, but the module seems to be found just fine.
So I'm wondering, what on earth does this error message mean? What is the OS trying to do but failing at? What might cause it? How might I debug it?
Some other threads suggest it might be to do with Python 3.8's new add_dll_directory, but I don't see why adding some specific debugger would cause this when everything runs fine without it?
I don't think it is an environment issue, as I've run everything through the same terminal. Also, it ran through RenderDoc just fine before performing various library upgrades, including an upgrade over the Python 3.8 boundary.

How to properly import libtcod in PyCharm?

I'm trying to set up a roguelike Python project, but I can't seem to be able to import libtcod module into my project. This helloworld crashes, and the IDE keeps telling me that there is no module named libtcodpy.
import libtcodpy
def main():
print('Hello World!')
if __name__ == '__main__':
main()
What is the proper way to import modules into Python projects? I'm used to Java, so I was expecting something along the lines of Maven to manage the dependencies. There indeed seems to be something like that in PyCharm as well, this package manager for the venv, which from what I gather serves to isolate the project-specific stuff from the OS- or python-global stuff:
but libtcod simply isn't present in the rather exhaustive list of modules that appears after clicking on the "+" button, just some other module that has something to do with libtcod library (I guess?). Moreover, all the tutorials I found on setting libtcod up advise one to manually copy over files somewhere or run some command that I suppose does the importing somehow and other such solutions, all of which i tried and none of which worked. I don't want to pollute my project structure by using such hodgepodge ways of handling dependencies if I can at all avoid it.
Q: How do I get libtcod to work in my PyCharm project in the most clean and convention-abiding way possible?
Take a look at this github project called tcod: https://github.com/libtcod/python-tcod/blob/master/README.rst#installation
It's a python port of libtcod.
To install using pip, use the following command:
python -m pip install tcod
If you get the error "ImportError: DLL load failed: The specified module could not be found." when trying to import tcod/tdl then you may need the latest Microsoft Visual C runtime.
Blockquote

Using python "requests" module in a cygwin64 ZNC module

I'm positive that I'm doing something wrong, but I've looked around and the solutions presented have not worked for me.
I'm writing a bot for ZNC running under Windows 10/cygwin64 (which allows python based scripts). One of the functions I'm trying to write requires the "requests" python module, but when I try to run the python bot, it throws this error:
ImportError: No module named 'requests'
I've tried placing the "requests" source in the same folder as the bot's .py file. I've also tried easy_install to no avail.
Oddly enough, I was toying around with another python module that was required, and it worked as soon as I placed it's source in the same folder.
The version of python that ZNC is running is 3.4.
Edit: I noticed that cygwin64 stores the python bins and libs for ZNC under a specific sub-folder. I've therefore installed the "requests" module under the relative lib/site-packages directory. I think it worked, as far as the module being visible, but now ZNC crashes as soon as I load that bot script. It throws this:
cygwin_exception::open_stackdumpfile: Dumping stack trace to
znc.exe.stackdump
When I check that stackdump, it has the following:
Exception: STATUS_ACCESS_VIOLATION at rip=001801A62CD

Python - How do you import downloaded directories/modules?

This is the first time I have attempted to use anything other than what's provided by python.
I have recently gotten into pythons provided Tkinter, though due to some issues I decided to use another GUI, and heard that PyQt was highly recommended, so I downloaded that and looked into various tutorials. In these tutorials, I cannot seem to execute any of the import statements in said tutorials that relate to PyQt, primarily PyQt5 (I have checked I have the correct version number by the way).
So for instance:
import PyQt5
raises the error:
Traceback (most recent call last):
File "/Users/MEBO/PycharmProjects/Music/testing.py", line 1, in <module>
import Qt
ImportError: No module named 'Qt'
[Finished in 0.1s with exit code 1]
I have a lot of research into this. I've heard people talk of using pip to install modules, and I have done this be safe (as well as downloading it from the internet), I've tried changing the project interpreter to versions Python3/ 2.7/ 2.6, appending the path name to the sys.path directory, (which I really know nothing about to be honest, I was hoping I'd get lucky), though nothing seems to work.
Are you supposed to be able to just import a module off the bat, or do you have to set some things up first?
For windows download the package and extract it to (path where python installed)\Python27\Lib and then try to import.
Specific to PyQt
This package cannot just be downloaded and imported, it must be built because it is not pure python, it uses Qt (C++) and requires dependancies. Read this tutorial on installation.
There is also a very complete python package distribution, Anaconda, that includes pyqt and much more. Almost all the packages I ever looked at are in there.
In general to pure python code
In other cases, if you place modules/code that has been download into the directory that your python script is run from, you can import off the bat, or you can append/insert any folder to the sys.path.
# importer will search here last
sys.path.append('/path/to/code/')
# importer will search here second, right after script's directory
# this can be useful to override a module temporarily...
sys.path.insert(1,'/path/to/code/')

Error in Netbeans 8.0 startup

I recently tried to install the NetBeans plugin described in: https://blogs.oracle.com/geertjan/entry/python_in_netbeans_ide_8
However when I now try and start NetBeans I get a horrendous error that starts like this:
Warning - could not install some modules: Java Source Queries - None of the modules providing the capability org.netbeans.modules.java.source.queries.spi.QueriesController could be installed. Debugger Core API - The module named org.openide.filesystems.compat8 was needed and not found. Resource Bundles - The module named org.openide.filesystems.compat8 was needed and not found. Quick Search API - The module named org.openide.filesystems.compat8 was needed and not found. Quick Search API - The module named org.netbeans.api.progress.compat8 was needed and not found. XML Core - The module named org.netbeans.api.xml.ui/1 was needed and not found. XML Core - The module named org.openide.filesystems.compat8 was needed and not found. XML Multiview Editor - The module named org.openide.filesystems.compat8 was needed and not found. Common Palette - The module named org.openide.filesystems.compat8 was needed and not found. Templates - The module named org.openide.filesystems.compat8 was needed and not found. Settings API - The module named org.openide.filesystems.compat8 was needed and not found. Auto Update Services - The module named org.openide.filesystems.compat8 was needed and not found. Auto Update Services - The module named org.netbeans.api.progress.compat8 was needed and not found. REST Application Platform Sample - The module named org.openide.filesystems.compat8 was needed and not found. .manifest file Editor Support - The module named org.openide.filesystems.compat8 was needed and not found. .diff File Editor Support - The module named org.openide.filesystems.compat8 was needed and not found. Java Support APIs - The module named org.openide.filesystems.compat8 was needed and not found. Java Platform - The module named org.openide.filesystems.compat8 was needed and not found. User Utilities - The module named org.openide.filesystems.compat8 was needed and not found. js-test-driver Wrapper - The module named org.openide.filesystems.compat8 was needed and not found. Editor Settings - None of the modules providing the capability org.netbeans.api.editor.settings.implementation could be installed. Editor Library 2 - None of the modules providing the capability org.netbeans.modules.editor.actions could be installed. HTTP Server - The module named org.openide.filesystems.compat8 was needed and not found. HTTP Server-Side Monitor - None of the modules providing the capability org.openide.util.HttpServer$Impl could be installed. HTTP Server-Side Monitor - The module named org.openide.filesystems.compat8 was needed and not found.
And goes on for pages and pages and pages.
I am running this on OS X.
I have deleted the directories /Users/<MyUser>/Library/Application Support/NetBeans and /Users/<MyUser>/Library/Caches/NetBeans, as I have seen mentioned in a few places, but I still receive the same error.
This is completely crippling me and preventing me from doing any work, I have no idea what has happened or how to resolve it.
Any help will be massively appreciated.
Having hit the same impasse, I searched up and down netbeans.org and other sites, provided my logs to bugs https://netbeans.org/bugzilla/show_bug.cgi?id=248986 and https://netbeans.org/bugzilla/show_bug.cgi?id=248291#c5
I exhaustively searched esp. jar and xml files in my %appdata%/Netbeans , sorted by latest modification times,
and found files like :
C:\Users\master\AppData\Roaming\NetBeans\8.0\modules
org-netbeans-modules-jira-rest.jar
org-netbeans-modules-jira-xmlrpc.jar
org-netbeans-modules-scanondemand.jar
etc.
but removing them, or swapping them out with a prior versions, did not help.
Seeing no real solution to even roll back failed updates, at least to get my Netbeans started at all again, I installed the nightly build http://bits.netbeans.org/download/trunk/nightly/latest/ elsewhere to compare (on a virtual machine, my "spare" PC).
Continued to compare the fresh installation with my broken installation.
No changes to my broken %appdata% seemed to allow NB to start.
Finally I compared the system-wide installation folders and found that in my broken copy, not only were many .jar files different in size, but some were missing altogether, including this one implicated widely in the startup errors I was getting:
C:\ProgramFiles\NetBeans\platform\core\org-openide-filesystems-compat8.jar
That was the strongest hint there won't easily be a "fix"....
It's as if some of the sources in https://forums.netbeans.org/posting.php?mode=quote&p=79922 should never have been allowed to make it into the Update Center. ( http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz in my case....though the chain of dependencies is totally unclear.)
Eventually I overwrote the entire C:\ProgramFiles\NetBeans\ folder from the fresh installation to the broken one, and started successfully.
It needed a few updates, then another restart.
Most of my settings were still there, Dark Theme, recent files list, etc.
Except the Ruby on Rails plugin, which had remained disabled, and I am still trying to re-add and enable it, since it is blocking even the opening of my ROR projects.
So in summary that awful partial workaround was probably equivalent to a re-installation of Netbeans using the development edition (previously I was on 8.0.2).
Please note well that you should not install development plugins (like Python or Scan-on-Demand) into a production installation. Doing so will most likely break your installation and you will be sad.
If you want to use development plugins, use a development distribution of NetBeans IDE from
bits.netbeans.org/download/trunk/nightly/latest/
There is currently a Python plugin made specifically for IDE 8.0.2; for more on this, visit Geertjan's blog at Oracle: https://blogs.oracle.com/geertjan/entry/python_in_netbeans_ide_81
If you are interested in developing or testing the NEW Python plugin, join the NetBeans Python Project at https://netbeans.org/projects/python/pages/Home

Categories

Resources