This is an easy one - your code is trying to:
To resolve this I would suggest:
Then going forwards make sure that you use steps 2 & 4 every time that you build your code.
Hope that helps
Steve Barnes
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pyinstaller...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyinstaller/47695ca5-37ac-4eb7-b93e-2ff89f6170d2n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/K6liK5_GqV4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/VI1PR03MB657526F5BD270019C42003649B349%40VI1PR03MB6575.eurprd03.prod.outlook.com.
Hi Claes,
It looks from your error messages as if the Anaconda installation of Python 3.7 has had the importlib-metadata library installed which is introducing this error. I would suggest, if you can, upgrading to at least Python 3.9 (3.10 is the current python) and using that as Python 3.7 ends security support in 1 year & 4 months. If you have to support Windows 7 then you would have to go for Python 3.8.
If you can't then you will need to either uninstall or downgrade importlib-metadata - if it was pip installed then pip uninstall importlib-metadata should do the job but as I rarely use Anaconda I am not sure how to do it with conda. Of course if you need to use importlib-metadata, (e.g. for keyring or twine) then you may be stuck with needing to upgrade your python.
Hope that is some help!
Steve
From: pyins...@googlegroups.com <pyins...@googlegroups.com>
On Behalf Of Claes Sterregaard
Sent: 15 February 2022 07:48
To: pyins...@googlegroups.com
Subject: Re: [PyInstaller] pyinstaller command giving "ImportError: cannot import name 'Protocol' from 'typing' eror"
Dear Steve.
Thank you for your kind reply.
I still wonder though - my app_basic.py does not include anything, it is just a print statement.
I can run the app_basic.py (as well as the actual program I eventually want to make an .exe for) without issues in my 3.7 environment.
Why is "typing.Protocol" suddenly in play when I run the pyinstaller command then?
All the best
Claes
Den tir. 15. feb. 2022 kl. 07.05 skrev Steve Barnes <Gadge...@live.co.uk>:
This is an easy one - your code is trying to:
- Use typing.Protocol which was introduced in Python 3.8 https://docs.python.org/3/library/typing.html#typing.Protocol
- Build and executable using PyInstaller using Python 3.7 from the error message paths below.
To resolve this I would suggest:
1. create a venv or equivalent that specifically uses python 3.8 or greater,
2. activate it and
3. install your dependencies including PyInstaller
4. Build your executable
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/CADWhU%2BfHvn5rbET_UO8%2BfXy1h%2BgfvRd1CHFT8NzR7Hvax96rhw%40mail.gmail.com.