After running
python -m nuitka --plugin-enable=pylint-warnings --follow-imports --standalone sample.py
it completes the build without any error but when I run the build sample file from sample.dist directory it gives
Traceback (most recent call last):
File "[PATH TO PROJECT]/sample.dist/pkg_resources/__init__.py", line 359, in get_provider
KeyError: 'pyfiglet.fonts'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[PATH TO PROJECT]/sample.dist/yarasilly2.py", line 183, in <module>
File "[PATH TO PROJECT]/sample.dist/pyfiglet/__init__.py", line 794, in __init__
File "[PATH TO PROJECT]/sample.dist/pyfiglet/__init__.py", line 801, in setFont
File "[PATH TO PROJECT]/sample.dist/pyfiglet/__init__.py", line 126, in __init__
File "[PATH TO PROJECT]/sample.dist/pyfiglet/__init__.py", line 136, in preloadFont
File "[PATH TO PROJECT]/sample.dist/pkg_resources/__init__.py", line 1134, in resource_exists
File "[PATH TO PROJECT]/sample.dist/pkg_resources/__init__.py", line 361, in get_provider
ModuleNotFoundError: No module named 'pyfiglet.fonts'
Nuitka version, full Python version and Platform (Windows, OSX, Linux ...)
python -m nuitka --version
0.6.8.4
Python: 3.8.3 (default, May 29 2020, 00:00:00)
Executable: [PATH TO PROJECT]/venv/bin/python
OS: Linux
Arch: x86_64
Nuitka Install
pip install nuitka
Sample piece of code
from pyfiglet import Figlet
if __name__ == '__main__':
f = Figlet(font='slant')
puts(colored.blue(f.renderText("Sample Text")))
Try the below code in the jupter notebooks
! pip install pyfiglet
Input the above code before you start your work..!
Let me know if that works....
And also support me, that brings motivation for further.
I met the same problem and after reading the user guide I found a solution.
python -m nuitka --plugin-enable=pylint-warnings --follow-imports --standalone sample.py --include-package=pyfiglet --include-data-dir={PATH-TO-PYFIGLET-LIB}=pyfiglet
Related
I was updating my Pypi package using:
python setup.py sdist bdist_wheel
Then, running:
python -m twine upload --https://github.com/ERijck/FuzzyTM https://test.pypi.org/legacy/ dist/*
Returned the following error:
(base) C:\Users\Emil\surfdrive\PhD\3. Python Scripts\GitHub\FuzzyTM>python -m twine upload --https://github.com/ERijck/FuzzyTM https://test.pypi.org/legacy/ dist/*
Traceback (most recent call last):
File "C:\Users\Emil\Anaconda3\lib\runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\Emil\Anaconda3\lib\runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Users\Emil\Anaconda3\lib\runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "C:\Users\Emil\AppData\Roaming\Python\Python38\site-packages\twine\__init__.py", line 32, in <module>
import importlib_metadata
File "C:\Users\Emil\Anaconda3\lib\site-packages\importlib_metadata\__init__.py", line 17, in <module>
from . import _adapters, _meta
ImportError: cannot import name '_adapters' from partially initialized module 'importlib_metadata' (most likely due to a circular import) (C:\Users\Emil\Anaconda3\lib\site-packages\importlib_metadata\__init__.py)
Based on the error and on this link it seems that I have a circular import. How can I fix this?
The problem was not a circular input. Having an older version of importlib_metadata installed caused the issue.
pip install -U importlib_metadata solved it.
Thank you for your time.
I installed virtualenv on my mac using pip, but when I ran virtualenv env, it showed an error:
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 6, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3241, in
#_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 583, in _build_master
ws.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'importlib-resources>=1.0' distribution was not found and is required by virtualenv
Please help. I installed the latest packaghes of importlib but it still doesn't work.
Your stack shows 2.7 python.
your tag question as python-3.x
You indicated that you already have importlib.
But error is about importlib-resources.
Try to import importlib_resources:
importlib_resources is a backport of Python 3.9’s standard library importlib.resources module for Python 2.7, and 3.5 through 3.8. Users of Python 3.9 and beyond are encouraged to use the standard library module. Developers looking for detailed API descriptions should refer to the Python 3.9 standard library documentation.
My jupyter notebook doesn't start due the dead kernel with following Kernel error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/web.py", line 1512, in _execute
result = yield result
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1069, in run
yielded = self.gen.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 67, in post
model = yield gen.maybe_future(sm.get_session(path=path))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 170, in get_session
return self.row_to_model(row)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 209, in row_to_model
raise KeyError
KeyError
In my case, the issue originated from having prompt-toolkit requirement conflict in jupyter-console and ipython.
You can use pip check to make sure whether you have the same problem. If the output is something similar to my output below, you have to fix the broken packages issue.
>>> pip check ipython
ipython 5.0.0 has requirement prompt-toolkit<2.0.0,>=1.0.3, but you'll have prompt-toolkit 2.0.9 which is incompatible.
>>> pip check jupyter-console
jupyter-console 6.0.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.
The quick fix is to try the solution originally mentioned here.
pip uninstall prompt-toolkit
pip install prompt-toolkit==1.0.15
pip uninstall jupyter-console
pip install jupyter-console==5.2.0
I try to make an easy Python gui, therefore I need to import tkinter. This package is available in Python 3, so I need that interpreter, but I can't get it started in Pycharm. It always asks to install packaging tools and then I get the same error everytime and I can't seem to fix it. I get the following:
Executed command:
/tmp/tmpu8m14jqspycharm-management/pip-9.0.1/setup.py install
Error occured:
AttributeError: module 'setuptools.dist' has no attribute 'check_specifier'
Command output:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2237, in resolve
return functools.reduce(getattr, self.attrs, module)
AttributeError: module 'setuptools.dist' has no attribute 'check_specifier'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmpu8m14jqspycharm-management/pip-9.0.1/setup.py", line 92, in <module>
cmdclass={'test': PyTest},
File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 272, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python3.5/distutils/dist.py", line 281, in __init__
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 327, in finalize_options
ep.load()(self, ep.name, value)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2239, in resolve
raise ImportError(str(exc))
ImportError: module 'setuptools.dist' has no attribute 'check_specifier'
I already searched some fixes but none actually worked.
Python PIP might not be installed. In Debian based distribution:
sudo apt-get install python3-pip
should solve if you use Python 3.
For Python 2.7x
sudo apt-get install python-pip
Close PyCharm and re-open it.
In this case, it may be possible that python pip (package installer) is not installed. So try installing that first.:
sudo apt-get install python3-pip
Just installed Jython 2.7beta3 and pip under Jython in mac os x
try to run /usr/local/Cellar/jython/2.7-b3/libexec/bin/pip install requests
Get error:
Traceback (most recent call last):
File "./pip", line 8, in <module>
sys.exit(
File "/usr/local/Cellar/jython/2.7-b3/libexec/Lib/site-packages/setuptools-11.3.1-py2.7.egg/pkg_resources/__init__.py", line 519, in load_entry_point
File "/usr/local/Cellar/jython/2.7-b3/libexec/Lib/site-packages/setuptools-11.3.1-py2.7.egg/pkg_resources/__init__.py", line 2630, in load_entry_point
File "/usr/local/Cellar/jython/2.7-b3/libexec/Lib/site-packages/setuptools-11.3.1-py2.7.egg/pkg_resources/__init__.py", line 2310, in load
File "/usr/local/Cellar/jython/2.7-b3/libexec/Lib/site-packages/setuptools-11.3.1-py2.7.egg/pkg_resources/__init__.py", line 2316, in resolve
File "/usr/local/Cellar/jython/2.7-b3/libexec/Lib/site-packages/pip-6.0.6-py2.7.egg/pip/__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/Cellar/jython/2.7-b3/libexec/Lib/site-packages/pip-6.0.6-py2.7.egg/pip/vcs/__init__.py", line 8, in <module>
from pip._vendor.six.moves.urllib import parse as urllib_parse
ImportError: No module named urllib
I found I can't install anything by pip under jython.
Please help me fix it, thanks.
I had the same problem trying to use pip for Jython2.7b3.
I downloaded this:
https://github.com/jythontools/pip/tree/master
And ran the command:
Jython setup.py install
And pip is now up and running like a charm.