Python ide thonny installation error in ubuntu - python

I am facing the below issue while installing thonny ide for python.
Traceback (most recent call last):
File "/home/shrivatsa/.local/lib/python3.5/site-packages/thonny/workbench.py", line 287, in _init_runner runner.start()
File "/home/shrivatsa/.local/lib/python3.5/site-packages/thonny/running.py", line 67, instart self.reset_backend()
File "/home/shrivatsa/.local/lib/python3.5/site-packages/thonny/running.py", line 427, in reset_backend self._proxy = backend_class(configuraration_option)
File "/home/shrivatsa/.local/lib/python3.5/site-packages/thonny/running.py", line 596, in __init__ self._start_new_process()
File "/home/shrivatsa/.local/lib/python3.5/site-packages/thonny/running.py", line 762, in _start_new_process my_env["JEDI_LOCATION"] = self_prepare_jedi()
File "/home/shrivatsa/.local/lib/python3.5/site-packages/thonny/running.py", line 703, in _prepare_jedi import jedi ImportError: No module named 'jedi'
The application launches but no run button and dedug button is active.

As the error message shows you are missing the module named "jedi".
Try to install it before installing the IDE:
pip install jedi

According to Thonny blog, this IDE uses Jedi (autocompletion/static analysis library). So make sure it also installed (via pip, for example).

Related

python3 -m build gives ModuleNotFoundError: No module named 'pathlib2'

I am trying to build a Python package, but it gives the following error.
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting dependencies for sdist...
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 351, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 285, in get_requires_for_build_sdist
return hook(config_settings)
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_sdist
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 482, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/build-env-eyqolcf7/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 5, in <module>
ModuleNotFoundError: No module named 'pathlib2'
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist
I have already installed pathlib2. What is the solution?
I have successfully build this in Python3.10. pip3.10 freeze gave me this output
build==0.8.0
packaging==21.3
pep517==0.13.0
pyparsing==3.0.9
tomli==2.0.1
As per the official documentation of the build package, it does not have a stable compatibility
https://pypa-build.readthedocs.io/en/latest/installation.html#compatibility
You can try switching to an older version of python (3.9 recommended) and try again,
ideally, that should solve the error since in traceback, the error seems to originate from setuptools ( which will be automatically reverted back to an older version with a older python version )
NOTE: You will also need to reinstall build in the new python version
Let me know if you face any issues with it.

ImportError: No module named _tkinter_finder

I am packaging my application using pyinstaller. It created the binary file, but it is not working. When I load the application on terminal I see this error
[9854] LOADER: Running BC_GUI_Client.py
Traceback (most recent call last):
File "FALCON_BC_CLIENT/BC_GUI_Client.py", line 145, in <module>
File "PIL/ImageTk.py", line 127, in __init__
File "PIL/ImageTk.py", line 192, in paste
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 687, in load_module
module = imp.load_module(fullname, fp, filename, ext_tuple)
ImportError: No module named _tkinter_finder
[9854] Failed to execute script BC_GUI_Client
I am using python 2.7 and installed pyinstaller 3.3
Anything wrong here?
I was able to resolve a simiar issue by running pyinstaller with the following option added in the command:
--hidden-import='PIL._tkinter_finder'
Your command should look like this:
pyinstaller module.py --hidden-import='PIL._tkinter_finder'

Running my Python script in my virtual env?

Total python noob here, I want to run my .py flask api file, i cd to my directory, activate my python virtual env, then i try run.py
Issue is that it prints:
$ python run.py
Traceback (most recent call last): File "run.py", line 1, in
from flask_sqlalchemy import SQLAlchemy ImportError: No module named flask_sqlalchemy
As far as im aware as im in my virtualenv and have my packages installed, this shouldnt happen. Trying to pip3 install on any packages shows them as already existing.
To further assist with the issue, i tried to run the script inside pycharm and i get the following error prints in the log:`Traceback (most recent call last):
File "/Users/Jack/Developer/Python/lift_api/run.py", line 26, in <module>
sqlAlchemy.create_all()
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 1007, in create_all
self._execute_for_all_tables(app, bind, 'create_all')
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 999, in _execute_for_all_tables
op(bind=self.get_engine(app, bind), **extra)
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 941, in get_engine
return connector.get_engine()
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 543, in get_engine
self._engine = rv = sqlalchemy.create_engine(info, **options)
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py", line 387, in create_engine
return strategy.create(*args, **kwargs)
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 80, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
File "/Users/Jack/Developer/Python/lift_api/liftapi/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 554, in dbapi
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'`
Anyone have an idea?
To run your code with python 3.x use python3 command.
python3 run.py
What is saying what it needs - psycopg2. If you are on Ubuntu it can help:
sudo apt install libpq-dev python-dev
Then don't forget to install flask-sqlalchemy and other libraries while your virtualenv activated.

DistributionNotFound when trying to run console script in setup.py

I created a virtualenv with python2.7 a few weeks ago and got this project running fine. It uses setuptools and has a few console scripts defined.
Now today I installed python3 and pip3, which I didn't think would conflict with this project but I'm running into this error when I try to run the same console script.
pkg_resources.DistributionNotFound: myproject==1.0.0.0-local
Traceback (most recent call last):
File "/Users/me/dev/myproject/venv-myproject/bin/run_queue_worker_manager", line 5, in <module>
from pkg_resources import load_entry_point
File "/Users/me/dev/project/venv-myproject/lib/python2.7/site-packages/pkg_resources.py", line 2720, in <module>
parse_requirements(__requires__), Environment()
File "/Users/me/dev/project/venv-myproject/lib/python2.7/site-packages/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)

Django: error with logging module when running any manage.py command

OSX, Python 2.7, pip, virtualenv. Been using these for years with no issues.
I'm not sure what changed, but recently my environment completely broke for Django after working perfectly fine for a while. The same checkout runs fine on my friend's computer with a similar setup.
Things I've already tried: deleting my venv and creating a new one with fresh installs from requirements.txt, uninstalling logging outside the venv and reinstalling inside, reinstalling pip.
I get the same traceback for any manage.py command. It appears to be having issues with the logging module:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/core/management/__init__.py", line 376, in execute
sys.stdout.write(self.main_help_text() + '\n')
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/core/management/__init__.py", line 242, in main_help_text
for name, app in six.iteritems(get_commands()):
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/conf/__init__.py", line 52, in __getattr__
self._setup(name)
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/conf/__init__.py", line 48, in _setup
self._configure_logging()
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/conf/__init__.py", line 75, in _configure_logging
logging_config_func(DEFAULT_LOGGING)
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/utils/dictconfig.py", line 555, in dictConfig
dictConfigClass(config).configure()
File "/Users/rfong/Dropbox/code/lattis_workspace/lattis_repo/venv/lib/python2. 7/site-packages/django/utils/dictconfig.py", line 323, in configure
del logging._handlerList[:]
AttributeError: 'module' object has no attribute '_handlerList'
It seems that you installed outdated 0.4.9.6 version of logging module, presumably with pip. Correct version, shipped with python 2.7 is 0.5.1.2, and I suppose in your case might be located in /Library/Python/2.7/lib/logging. Correct version can be uploaded from python svn.
If you use pip, you always can find out which module versions are installed with
$ pip freeze
to ensure that correct versions of packages are installed, use following syntax:
$ pip install <package>==<version>
this will save you lot of pain and efforts, and almost a must on production environments.

Categories