Import problem with numpy on Eclipse 2018-09 - eclipse

I'm have a problem using numpy with the latest Eclipse 2018-09 and PyDev 7.0.3. I'm using the latest Anaconda Python 3.7.0 which includes numpy version 1.15.1
I believe I have PyDev setup properly as I can run and debug python program that do not use numpy.
Whenever I try to "import numpy as np", I get this error:
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
I've found a work-around by adding this single directory to the system path (not the PYTHONPATH):
C:\ProgramData\Anaconda3\Library\bin
I do this outside of Eclipse and need to restart Eclipse after changing the system path.
Hopefully, someone can explain the proper way to configure PyDev so that I don't have to pollute my system path.
Thanks!

I have had to do a half 4 or 5 installs of anaconda python in the last half year, and I think every one has been a struggle to get numpy to work. Today I can remember only the final trick that got me past that error:
This system is clean install of Windows 10, and Eclipse version 2019-12(4.14.0) Build id 20191212-1212. 64bit. In Eclipse the Python interpreter (3.7.6) is working otherwise. And Python loads numpy from a command prompt, just not within Eclipse.
In Eclipse Navigator window, right click on a PyDev project and select properties.
On the left select PyDev - Interpreter/Grammar.
On the right 'Click here to configure an interpreter not listed'. (But this will actually configure the listed interpreter.)
Then click on Open interpreter preferences page.
Now in the left tree, select Pydev / Interpreters / Python Interpreter.
On the right lower, choose the Environment Tab, On the far right lower click Add.
In the New Environment Variable window,
in Name enter PATH
in Value enter \anaconda3\Library\bin
Happyness for me! It worked without having to re-start Eclipse.
I had previously added the same path to the user's PATH in the Windows environment settings, without effect. I had earlier checked 'load conda env vars before run', and have left that checked.

In the interpreter configuration (window > preferences > PyDev > Interpreters > Python interpreter), you should be able to select the interpreter you want, go to the environment tab and set the PATH environment variable to be as you want (so, any launch with that interpreter will use the PATH you specified).
Now, I see you're using Anaconda... have you tried checking the Load conda env vars before load? to see if it fixes it for you? (that appears in the package tab when you select the interpreter).

Related

Eclipse Blender and PyDev Unresolved import pydevd

I have python installed at:
C:\Users\xxxx\AppData\Local\Programs\Python\Python35-32
My PATH variable is:
C:\Users\xxxx\AppData\Local\Programs\Python\Python35-32\Scripts\;
C:\Users\xxxx\AppData\Local\Programs\Python\Python35-32
And I have this in Eclipse:
And finally I have this -.- (you can see that 'import sys' works:
Ok, I find what was wrong.
First, it is needed to download module, in this case pydevd
Be careful, download not latest (like I did wrong first time) but with version of python it is installed.
In my case it is Python 3.5.3 so I choose:
pydevd-1.3.0-cp35-cp35m-win32.whl
Then install it with pip, it is easy:
pip install C:%where_it_is_downloaded%/pydevd-1.3.0-cp35-cp35m-win32.whl
Then there will be pydevd added to Packages beside pip and setuptools:
And one more thing.
Compare this 2 screens. Path to site-packages has to be changed from lib to Lib.
As a tip, as the debugger is usually only temporarily used, so, you could just use the internal version from PyDev if you're Ok with the unresolved imports and just want to connect the remote debugger to Blender.
You could do that by using the pydevd template (i.e.: write inside PyDev pydevd and press Ctrl+Space and the option which would add it to the PYTHONPATH and then connect to the remote debugger would appear).
See: http://www.pydev.org/manual_adv_remote_debugger.html for more details on the remote debugger.

how to set the interpreter of wxpython for eclipse once for all

I've Eclipse, python 2.7, wxpython 2.8, and OSx 10.5.8
I would like wxpython is included correctly in my eclipse environment, to have not all the wxpython commands underlined as errors.
I've imported in the PYTHONPATH, via preferences, the correct path of the wx library. Once I import them manually in the Eclipse, save settings, then it works.
But if i close Eclipse, and open it again, even if the interpreter have its own path of wxpython, it seems it's not recognized, and I've no autocomplete, no documentation. I need to remove and add again the same path to make everything work. It still happen after months. I guess it maybe a problem of macosx eclipse.
Do you know why?
Do you agree?
thank you in advance
I always go to Preferences / PyDev / Interpreter - Python. Then add a new interpreter, and just click Add and Apply. Wait until everything is parsed, this takes a while. Then click OK.
Change the interpreter from "Default" to your newly set-up interpreter.
Check if correct interpreter is set for your project. Right-click the project / Properties / PyDev - Interpreter/Grammar. New projects should get this by default.

Pydev say, "Unresolved import" error

hm..
Sometime, PyDev say "Unresolved import error".
In my environment
Python2.6.6 Eclipse3.7 PyDev2.2.2
Errors are.
> Unresolved import: pycassa -> import pycassa Unresolved import:
> WebSocketHandler -> from geventwebsocket.handler import
> WebSocketHandler Unresolved import: tweepy -> import tweepy
Is there any helpfull information?
Had the same problem. In the end I was able to fix the problem by deleting my old interpreter in Preferences > PyDev > Interpreters, and creating a new interpreter called "python" which had the correct paths. After quitting and reopening eclipse, pydev found all my modules.
Probably your PYTHONPATH is not set properly (or if those are libraries in the interpreter, maybe you added them after configuring it).
See: http://pydev.org/manual_101_interpreter.html for references (note the part on forced builtins there as it might be your case).
You get an unresolved import if the required module cannot be found. Modules are searched for in the current working directory and the directories listed in sys.path. Your python cannot find the modules pycassa and tweepy it appears.
Might want to check this: http://klaith.wordpress.com/2009/06/12/pydev-unresolved-import-errors/
I solved by recreate the interpreter. There is a guide at pedev.org:
What if I add something new in my System PYTHONPATH after configuring
it?
If you add something to your python installation, you need to either
add it manually as a 'new folder' in the System PYTHONPATH (if it's
still not under a folder in the PYTHONPATH) or (recommended) remove
your interpreter and add it again, then, press apply.
Note that if you added a library that's already under a folder in the
PYTHONPATH, you have to at least go to the interpreter preferences and
press apply so that it clears its internal caches (after the
configuration is done, things are set in stone for PyDev)
Thanks for Fabio Zadrozny and nicodjimenez.
I had a similar problem before. I solved the problem by this steps:
1)Window > Preferences > PyDev > Interpreters > Python Interpreter
2)Delete the Python Interpreter path you added previously
3)Add "New" Python Interpreter and choose python.exe path
4)Check Libraries tab (I found the problem at this step.)
Check your path name, is it true or false? Eclipse detect "C:\Python27\lib" but it should be "C:\Python27\libs" and "C:\Python27\Lib".
In the properties for your pydev project, there's a pane called "PyDev - PYTHONPATH", with a sub-pane called "External Libraries". You can add source folders (any folder that has an init.py) to the path using that pane. Your project code will then be able to import modules from those source folders.
Check this two links it may be helps to you,
Unresolved Import Issues with PyDev and Eclipse
Unresolved import: models
Is pycassa found as a symlink within a directory on your PYTHONPATH? Pydev apparently has a bug where its code analysis cannot follow symlinks (and hence will not see your libraries). The python interpreter can though of course.
I was having a similar problem with the dbfpy module.
I had downloaded the tar archive and installed the source files in /usr/lib/python2.7/dist-packages
With this I was able to import the packages in IDLE and even run the code in Eclipse. However the pydev import was still showing as an error with the message "unresolved import"
As suggested by Fabio, I checked the PyDev documentation for forced-builtins. Just adding the name of the package ("dbfpy" in my case to the Forced Builtit tab of Python Interpretr in Eclipse) solved the issue.
(I know the answer is a bit late)
if you installed a python package using, for example: pip install django
i solved the unresolved import issue doing this:
In eclipse:
Window > Preferences
In the left panel tree structure go to:
PyDev > Interpreter - Python
In the upper right panel be sure to have the correct interpreted selected
and in the bottom right panel, click New Folder, navigate to your python installation site-packages (usually in c:\Python33\Lib\site-packages) and search for a folder that ends with .egg-info
In my pc it is "C:\Apps\Environments\Python33\Lib\site-packages\Django-1.5.4-py3.3.egg-info" since i installed python in C:\Apps\Environments, should be different in your case.
This worked with django and selenium, should work with all others as well (as far as i know)
Adding the corresponding package folder ending with '.egg-info' to PyDev > Interpreter - Python - library will resolve the problem.
In Linux, it is usually under /usr/local/lib/pythonX.X/dist-packages
Add site-packages path in environmental variables.
Right click on
computer -> properties -> advanced system settings -> Environmental
variables
.
After that is done, remove the python interpreter and add it again in eclipse.
right click project name in
eclipse --> properties --> python interpreter
.
Hope it works.

How To Make Eclipse Pydev Plugin Recognize Newly Installed Python Modules?

So I just installed SubnetTree (http://www.icir.org/robin/pysubnettree/) and if I open the Python interactive interpreter I can successfully import it without any error messages. I use it in one of my programs and can successfully run it without a hitch. However, Eclipse marks the import as an error, and this is a problem as I use Eclipse for debugging. I have gone to preferences and have restored the Python interpreter I am using to no avail. I was able to merely restore the Python interpreter exit, and reopen it on my other machine(OS X 10.5, I am now using OS X 10.6) and it identified SubnetTree just fine. Any idea of how I should go about this? Thanks in advance.
if you already tried "refreshing" your interpreter's PYTHONPATH (in Eclipse's Pydev Python interpreter configuration) and it didn't work you could try deleting the interpreter from the list and creating it again. When doing this, you should get all your modules loaded correctly, even the missing new modules.
PyDev version 3.6, on the Eclipse Preferences -> PyDev -> Interpreters preferences pane, offers a button labeled "Check if interpreters are synchronized with environment". On my mac and Eclipse Luna, clicking on this button triggered some behind-the-scenes magic that solved my problem of PyDev not noticing a new installation of PeeWee. I saw a message flash briefly in the lower-right corner of the main Eclipse window "Synch System PYTHONPATH." I did not remove nor re-add the interpreter (Python 2.7), restarting Eclipse did not solve the problem either; but clicking this button did.
Yes - it works! I've been stuck on this for three days. Go to Project, Properties, PyDev - Interpreter/Grammar, "Click here to configure an interpreter not listed", highlight & Remove python (C:/Python27\Python.exe), Auto Configure (brings up a list below that you can review and checkmark as needed), then click on OK.

Setting up Pylint with PyDev

I have installed pylint via easy_install. I can run pylint <filename> with success. But pydev refuses to use it.
I checked "use pylint"
I configured correct path
I updated my python interpreter in eclipse to have pylit in pythonpath
I use Eclipse Galileo
I have build automatically checked
I tried cleaning whole project and no errors
What am I doing wrong?
I'm guessing you may need to mark the folder that contains your code as a source folder. You can do this under project properties.
Project->Properties->PyDev-PYTHONPATH
add relevant folders to the list of sources.
I've noticed that Pydev won't run Pylint on files with dashes (hyphens) the the filename; according to the Pydev devs, '-' is not a valid Python module name character, and it doesn't look like they intend to fix it:
http://sourceforge.net/tracker/index.php?func=detail&aid=1915426&group_id=85796&atid=577329
http://sourceforge.net/tracker/index.php?func=detail&aid=2888890&group_id=85796&atid=577332
As if nobody writes scripts in Python... Grumble grumble...
To provide an alternative solution, pylint can be used as an External Tool in Eclipse. This requires having previously installed the pylint package for a Python installation.
Remember to first have a pylintrc file somewhere where pylint can find it, failing which a "No config file found" error is printed. Typically I would touch pylintrc inside the project directory, and keep the file in version control. For reference, see pylint command-line options.
In Eclipse, select Run, External Tools, External Tools Configurations.... Click the toolbar button to create a New launch configuration. Configure as below or as desired:
Name: pylint
Location: ${system_path:pylint}
Working Directory: ${project_loc}
Arguments: --reports=n "${resource_loc}"
Remember to click inside an open file to switch focus to it before running the above external tool for it. Failing this, an error can occur.
The output of the external tool will by default be printed to the console.
Related: Setting up pep8 as an External Tool in Eclipse