Pidev says "Unauthorized import" error

um .. Sometimes PyDev says "Unresolved import error." In my midst

Python2.6.6 Eclipse3.7 PyDev2.2.2

Mistakes

> Unresolved import: pycassa -> import pycassa Unresolved import: > WebSocketHandler -> from geventwebsocket.handler import > WebSocketHandler Unresolved import: tweepy -> import tweepy 

Is there any useful information?

+6
source share
11 answers

There was the same problem. In the end, I was able to fix this problem by deleting my old interpreter in Preferences> PyDev> Interpreters and creating a new interpreter called "python" that had the correct paths. After exiting and reopening the eclipse, pydev found all my modules.

+5
source

Perhaps your PYTHONPATH is not installed correctly (or if these are libraries in the interpreter, you may have added them after setting it up).

See: http://pydev.org/manual_101_interpreter.html for links (pay attention to the part of the forced ones in there, as it may be in your case).

+4
source

You get an unresolved import if the required module is not found. The search for modules is performed in the current working directory and in the directories listed in sys.path. Your python cannot find the pycassa and tweepy modules that appear.

You can check this out: http://klaith.wordpress.com/2009/06/12/pydev-unresolved-import-errors/

+2
source

I decided by recreating the translator. There is a guide for pedev.org :

What if I add something new to my PYTHONPATH system after setting this up?

If you are adding something to your python installation, you need to either add it manually as a β€œnew folder” in System PYTHONPATH (if it is not already under a folder in PYTHONPATH) or (recommended) remove your interpreter and add it again, then Click "Apply."

Please note that if you added a library that is already in the folder in PYTHONPATH, you should at least go to translator preferences and click to clear the internal caches (after the configuration is done, things are set for the PyDev stone)

Thanks for Fabio Zadrozny and nicodjimenez .

+2
source

I had a similar problem. I solved the problem with the following steps:

1) Window> Settings> PyDev> Translators> Python Interpreter

2) Delete the previous Python Interpreter path

3) Add the "New" Python Interpreter and select the python.exe path

4) Tab "Check libraries" (I found the problem at this step). Check your path, is it true or false? Eclipse detects "C: \ Python27 \ lib", but it should be "C: \ Python27 \ libs" and "C: \ Python27 \ Lib".

Check and add true path

The path to the file

+1
source

Is pycassa found as a symbolic link in your PYTHONPATH directory? Pydev apparently has an error when his code analysis cannot follow symbolic links (and therefore will not see your libraries). Perhaps the python interpreter may of course

0
source

I had a similar problem with the dbfpy module.

  • I downloaded the tar archive and installed the source files in / usr / lib / python 2.7 / dist-packages

  • With this, I was able to import packages into IDLE and even run the code in Eclipse. However, pydev imports still showed up as an error with the message "unauthorized imports"

  • As Fabio suggested, I checked the PyDev documentation for forced built-in functions. Just adding the package name ("dbfpy" in my case to the Python Interpretr Force Configuration tab in Eclipse) solved the problem.

0
source

(I know the answer was a bit late)
if you installed the python package, for example: pip install django
I solved the unresolved import problem:
In the eclipse:
Window> Preferences
In the left tree structure, go to:
PyDev> Interpreter - Python
Make sure that the correct one is selected in the upper right pane and click "New Folder" in the lower right pane, go to the python installation sites (usually in the folders c: \ Python33 \ Lib \ site-packages) and find the folder that ends with. egg-info
On my computer, this is "C: \ Apps \ Environments \ Python33 \ Lib \ site-packages \ Django-1.5.4-py3.3.egg-info", since I installed python in C: \ Apps \ Environments, there should be to others in your case. This worked with django and selenium, should also work with everyone else (as far as I know)

0
source

Adding the appropriate package folder ending with ".egg-info" in PyDev> Interpreter - the Python library will solve the problem.

On Linux, this is usually located under / usr / local / lib / pythonX.X / dist-packages

0
source

Add the path of site packages to environment variables.

Right click

computer β†’ properties β†’ advanced system settings β†’ Environmental Variables

.

After that, remove the python interpreter and add it again in eclipse. right click on the project name

eclipse -> properties -> python interpreter

.

Hope this works.

0
source

The properties of your pydev project have a panel called "PyDev - PYTHONPATH" with subpanels called "External Libraries". You can add source folders (any folder with init .py) to the path using this panel. Then the project code will be able to import modules from these source folders. Check out these two links that may help you, Unresolved import issues with PyDev and Eclipse

Unauthorized imports: models

0
source

Source: https://habr.com/ru/post/896476/


All Articles