I can't use pyinstaller - python

Abstract
I have installed pyinstaller.
pip install pyinstaller
This is probably a successful installation.
When I ran the same command again, this is what I got.
Areas marked in black are personal information.
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyinstaller in c:\users\████\appdata\roaming\python\python36\site-packages (4.10)
Requirement already satisfied: altgraph in c:\users\████\appdata\roaming\python\python36\site-packages (from pyinstaller) (0.17.3)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\████\appdata\roaming\python\python36\site-packages (from pyinstaller) (2022.0)
Requirement already satisfied: setuptools in c:\program files\python36\lib\site-packages (from pyinstaller) (40.6.2)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\████\appdata\roaming\python\python36\site-packages (from pyinstaller) (2022.5.30)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\████\appdata\roaming\python\python36\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: importlib-metadata in c:\users\████\appdata\roaming\python\python36\site-packages (from pyinstaller) (4.8.3)
Requirement already satisfied: future in c:\users\████\appdata\roaming\python\python36\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\████\appdata\roaming\python\python36\site-packages (from importlib-metadata->pyinstaller) (4.1.1)
Requirement already satisfied: zipp>=0.5 in c:\users\████\appdata\roaming\python\python36\site-packages (from importlib-metadata->pyinstaller) (3.6.0)
And when I finally tried to exe the python application, it failed.
What I tried
First, we typed the following command.
C:\Program Files\Python36>pyinstaller testexe.py --onefile
It then returned the following
'pyinstaller' is not recognized as an internal or external command, an
It is not recognized as an operable program or batch file.
(Original)
'pyinstaller' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
I followed without fail and typed the following commands.
C:\Program Files\Python36>py -m PyInstaller testexe.py --onefile --windowed
It then returned the following
Unable to create process using 'C:\Users\████\AppData\Local\Programs\Python\Python311\python.exe -m PyInstaller testexe.py --onefile --windowed': ??????????????????
supplementary information
Python 3.6.1

I prefer you try this command:
$ python -m pip install pyinstaller

Related

Pipreqs installation

I am having difficulty generating the requirements.txt file. It says directory not found on I change the directory to file location. I have created my webapp using streamlit library.
Microsoft Windows [Version 10.0.19044.2251]
(c) Microsoft Corporation. All rights reserved.
C:\Users\lucy22>cd firstprog
The system cannot find the path specified.
C:\Users\lucy22>cd C:\Users\lucy22\PycharmProjects\firstprog\error404.py
The directory name is invalid.
C:\Users\lucy22>pip3 install pipreqs
Requirement already satisfied: pipreqs in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (0.4.11)
Requirement already satisfied: docopt in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from pipreqs) (0.6.2)
Requirement already satisfied: yarg in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from pipreqs) (0.1.9)
Requirement already satisfied: requests in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from yarg->pipreqs) (2.26.0)
Requirement already satisfied: idna<4,>=2.5 in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from requests->yarg->pipreqs) (3.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from requests->yarg->pipreqs) (2.0.6)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from requests->yarg->pipreqs) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\lucy22\appdata\local\programs\python\python39\lib\site-packages (from requests->yarg->pipreqs) (1.26.7)
WARNING: You are using pip version 21.1.3; however, version 22.3.1 is available.
You should consider upgrading via the 'c:\users\lucy22\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command.
C:\Users\lucy22>cd C:\Users\lucy22\PycharmProjects\firstprog\error404.py
The directory name is invalid.
To generate requirements.txt
pipreqs --encoding=utf8 C:\\Users\\lucy22\\PycharmProjects\\firstprog
Why you got that error:
You got that error message because you are trying to open error404.py file with a cd command, the cd command is used for navigating through directories and error404.py is a file not a directory.
To navigate or change directory:
Your working directory is C:\Users\lucy22. So there is no need to include that in you command.
You should rather write the below command and that will take you to the firstprog directory where your error404.py file is located.:
cd PycharmProjects\firstprog
To open a file:
If you are looking to open error404.py file, you should use the open command.
Example:
open PycharmProjects\firstprog\error404.py

Python - Can't install pyinstaller

I'm using Windows 10.
In my project folder, I'm trying to test it as an exe.
So, I did this to install Pyinstaller:
py -m pip install pyinstaller
And it said it installed.
But when I did py -m pyinstaller emu.py, it just returned this:
C:\Users\tux\AppData\Local\Programs\Python\Python310\python.exe: No module named pyinstaller
Can someone help?
If I try to install pyinstaller using PIP again, it comes up with this error:
Requirement already satisfied: pyinstaller in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (5.3)
Requirement already satisfied: pyinstaller-hooks-contrib>=2021.4 in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (2022.8)
Requirement already satisfied: altgraph in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (0.17.2)
Requirement already satisfied: pefile>=2022.5.30 in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (2022.5.30)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: setuptools in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (58.1.0)
Requirement already satisfied: future in c:\users\tux\appdata\local\programs\python\python310\lib\site-packages (from pefile>=2022.5.30->pyinstaller) (0.18.2)
It's saying Pyinstaller is already installed, but python doesn't recognise it.
Before you ask, if I try to just run pyinstaller as a standalone command, it says it cannot find pyinstaller.
Edit: It's been over a month and nobody has replied.
Forget it. I'm just not gonna make the application.
Did you try the generic way
pip install pyinstaller
also refer to this pypi link https://pypi.org/project/pyinstaller/

I have a problem with pytest execution, I install the pytest but it doesnot show it's version neither it works

C:\Users\sbhandari>python --version
Python 3.9.1
C:\Users\sbhandari>pip install pytest
Collecting pytest
Using cached pytest-6.2.1-py3-none-any.whl (279 kB)
Requirement already satisfied: toml in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (0.10.2)
Requirement already satisfied: pluggy<1.0.0a1,>=0.12 in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (0.13.1)
Requirement already satisfied: iniconfig in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (1.1.1)
Requirement already satisfied: py>=1.8.2 in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (1.10.0)
Requirement already satisfied: packaging in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (20.8)
Requirement already satisfied: attrs>=19.2.0 in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (20.3.0)
Requirement already satisfied: atomicwrites>=1.0; sys_platform == "win32" in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (1.4.0)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pytest) (0.4.4)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\sbhandari\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from packaging->pytest) (2.4.7)
Installing collected packages: pytest
WARNING: The scripts py.test.exe and pytest.exe are installed in 'C:\Users\sbhandari\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pytest-6.2.1
WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Users\sbhandari\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.
C:\Users\sbhandari>pytest
'pytest' is not recognized as an internal or external command,
operable program or batch file.
it worked on my computer,i think its not working on your computer because you haven't added it to system variables(PATH),here's how you can do so
pytest and other scripts are mostly present in a directory(in python folder) named 'Scripts'.maybe yours is somewhere else and if so then type pytest.exe in start menu and copy the file location and add it to system variables.if this doesnt work try re-installing pytest or python.
Edit:if you check the output pip is telling you that WARNING: The scripts py.test.exe and pytest.exe are installed in 'C:\Users\sbhandari\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.just add the directory above on your path and it should solve your problem

How to solve Python Pylint installation error

I tried to install Pylint in my VS Code using the following command:
pip install pylint
and the output was this:
Requirement already satisfied: pylint in c:\users\domin\appdata\roaming\python\python39\site-packages (2.6.0)
Requirement already satisfied: toml>=0.7.1 in c:\users\domin\appdata\roaming\python\python39\site-packages (from pylint) (0.10.1)
Requirement already satisfied: astroid<=2.5,>=2.4.0 in c:\users\domin\appdata\roaming\python\python39\site-packages (from pylint) (2.4.2)
Requirement already satisfied: isort<6,>=4.2.5 in c:\users\domin\appdata\roaming\python\python39\site-packages (from pylint) (5.6.1)
Requirement already satisfied: colorama in c:\users\domin\appdata\roaming\python\python39\site-packages (from pylint) (0.4.3)
Requirement already satisfied: mccabe<0.7,>=0.6 in c:\users\domin\appdata\roaming\python\python39\site-packages (from pylint) (0.6.1)
Requirement already satisfied: six~=1.12 in c:\users\domin\appdata\roaming\python\python39\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.15.0)
Requirement already satisfied: wrapt~=1.11 in c:\users\domin\appdata\roaming\python\python39\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.12.1)
Requirement already satisfied: lazy-object-proxy==1.4.* in c:\users\domin\appdata\roaming\python\python39\site-packages (from astroid<=2.5,>=2.4.0->pylint) (1.4.3)
and it only returns the simple cursor:
PS C:\Users\domin>
And whenever I try to use it, VS Code returns the following message:
pylint : The term 'pylint' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pylint .
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (pylint:String) [], CommandNotFo
undException
+ FullyQualifiedErrorId : CommandNotFoundException
What should I do?
This output shows you, that you've already got this package and it's dependencies installed in site-packages of python 3.9.
If you need to install it with specific python version installed on your machine you shold type following:
/path/to/your/bin/python -m pip install pylint
Same with virtualenv. If you want to install it into virtualenv python:
source mypython/bin/activate
pip install pylint
First answer is to put python on PATH, If that does not work you can go to the user settings (in vs code) and edit the "python.linting.pylintEnabled" to True.
If even that does not work then:-
Copy the path where pylint is installed on your computer.
Go to your vs code settings and click on the preferences tab.
Edit this line
"python.linting.pylintPath": "pylint"
replace pylint with the path of your pylint installation.

why Visual studio code can not find pandas when it is already installed

I followed this instruction https://code.visualstudio.com/docs/python/python-tutorial to install pandas. and when I check it is installed:
python -m pip install pandas
Requirement already satisfied: pandas in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (1.1.4)
Requirement already satisfied: pytz>=2017.2 in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (from pandas) (2020.4)
Requirement already satisfied: numpy>=1.15.4 in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (from pandas) (1.19.1)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\mansour\appdata\roaming\python\python37\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
I am running this command in Visual Studio Code Python terminal.
but in my code, I have this error:
and when I run the application, I am getting this error:
Why I am getting this error?
it may be the reason for the environment. please check the correct environment is select or not while running the code.
I Think you have installed in different environments and running the code in different environments.

Categories