How to fix prettytable installation - python

I can install, uninstall and upgrade prettytable using pip [un]install [-U] prettytable. But running the mbed-tools compile command keeps on reporting "ModuleNotFoundError: No module named 'prettytable'"
I can see the package is added to my ...\appdata\local\programs\python\python39\Lib\site-packages\ folder. According to my environmental path the folder ...\appdata\local\programs\python\python39\Scripts\ is added and many packages has en .exe file installed there, but prettytabe is missing. Could this be the problem? If so, how do I install it and ensure that it actually has en exe install too?
I'm running python 3.9.7 on pretty-much-the-latest Windows 10.

So it turned out I had Python 3.8.7 installed together with Python 3.9.7. So uninstalling the older one solved the problem...

Related

Why does python give me an error when i am importing modules?

I have installed today Python 3.8.1 (i had 3.7.* months ago, but don´t use it anymore) and I tried to write new code, but I have problems to import modules like matplotlib and so on. It will always mark the module name yellow and says:
unresolved import ‘matplotlib' Python(unresolved-import)
I checked if python is in the PATH included, I installed/reinstalled the matplotlib module but nothing works. I am using Win 10 64Bit, Python 3.8.1 64Bit and VS Code.
Best way to do that is in a virtualenv, have a look at this.
python3.8 -m venv env-name # this will create a folder with executables of python, pip.
To activate it you can run
source env-name/bin/activate # Linux/Mac
env\Scripts\activate.bat # For windows
pip install matplotlib # Matplotlib will be installed for the activated env only
I solved the problem by uninstalling python and deleting all existing files from python and installing a new clean version of the newest version of python. After this i used pip to install all required modules to code.
Thanks for the help!
You may also use the following command in cmd in admin mode:
python -m pip install matplotlib
if you are running it on the command prompt after installing the python.

import qsharp ModuleNotFoundError: No module named 'qsharp'

I install the python library named Python.NET package using pip install pythonnet, clr module is installed and imported, installation of qsharp module independently is done successfully but importing qsharp is displaying error.
Can anyone tell me why it is giving error while importing?
I am using spyder to run python code and anaconda for installation.
The process for installing qsharp is a little convoluted as you have to "install" it more than once.
The first install would be something like:
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
The second install (that trips some of us up) is you then have to also:
pip install qsharp
After that it should import correctly in Python.
Try
pip3 install qsharp
Then
python3 x.py
You have to be careful from the version of Python that you're using , if you have many versions on your computer delete them and let only the most recent one , however Q# is installed in 2 steps :
Installing package :
pip install qshart
Then installing kernel ( you'll need to install dotnet ) :
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
I was using VScode and getting this error very frequently. I realized that i needed to change the environment to the one in which qsharp was installed.. as it needed to be installed in different environment than base.
Also you will need to get the terminal to the directory where your code is.
Just posted as I did struggle with this early on.

Virtualenv error, unable to create process

I recently cleaned up my system variables and I think I might have mixed something up. I have two versions of Python installed: 3.4 and 3.6.2. One is situated in C:/Python3.4 and the other one in AppData folder. I wanted to use Python 3.6.2 and virtualenv again to create another working environment, but I get the following error:
Fatal error in launcher: Unable to create process using '"'
If I try using pip, everything works fine and virtualenv is installed.
Happenned to me today.
I solved it by uninstalling python and installing Python x86 in C:\Python\Python37_32 FOR ALL USERS
Then I've added C:\Python\Python37_32 and C:\Python\Python37_32\Scripts to the PATH env variable.
Then using cmd I installed virtualenv with pip install virtualenv.
After that virtualenv worked like a charm.
Hope this helps
I tried almost all measures I can search on Google. But I solved this issue by re-install certifi pip install certifi

Python 2.7.11 pip not installed

I have Python 2.7.11 installed on my machine which to my understanding should come with pip, however when I check the C:\Python27\Tools\Scripts\ directory there is no pip.exe present.
I have tried completely removing and reinstalling Python 2.7.11 without success. Running the installer pip is set to be installed, but after the install pip is nowhere to be found.
I also have Python 3.4 installed which has pip as expected. Any thoughts?
I encountered the same problem - pip not installed - with python-2.7.16, Win10, installing for 'all users'. It was resolved when I allowed the MSI installer to target the default location (C:\Python27) rather than changing it to under Program Files (x86). I've no clue why this changed anything.
python2.7.11 should install pip into c:\python27\scripts, you can take a look here
I used https://pip.pypa.io/en/stable/installing/ to make it install. Odd that an outside body has to make a tool to get pip to install. There is no mention of pip.pypa.io on the Python web site.
Although I got error messages, it did install, so check carefully.
You also may see a message suggesting that you upgrade to pip 9.0 with the command 'pip install --upgrade.' I highly recommend that.
Also, make sure you are in the directory where pip.exe is located when you run the commands. They don't tell you that, because they assume you know that, but we're not all geeks.
For people who are running into this issue, I have a Windows 10 x86 dev box that I use for exploit development, Python 2.7 was installed due to Immunity Debugger, this install did not include the new SSL package and did not include "pip".
There was no "C:\Python27\Scripts" folder which included pip. I did have a "C:\Python27\Tools\Scripts" folder which did not have pip installed.
I tired to install pip as suggested but did not work. Best way is to uninstall Python and install newest version, currently mine is 2.7.15 which came with pip as an option. This is what solved my issue, any older version of Python will need upgraded to support the SSL packages. You will receive the same errors when you try to install pip on an older version.
If you have reinstalled Python which included the SSL package and it still does not have pip, trying installing pip this way:
1. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
2. python get-pip.py
https://pip.pypa.io/en/stable/installing/
This should work if you have a newer version of Python.
Once you have installed pip or newer version of python, go to "C:\Python27\Scripts" and you should see pip.exe.
I have installed "python-2.7.16" in my windows 10 PC. PIP is installed under "C:\Python27\Scripts". One can add the "C:\Python27\Scripts" path to environment variable and then access pip command from command prompt.
To add the path in environment variable:
Control Panel\System and Security\System --> Advanced System Settings --> Advanced --> enviroment variables --> under system variable --> Path(variable name)
Had the issue where no matter which version of python 2.7 I installed on windows 10 there was no pip.exe generated in the "Scripts" folder.
I solved it by ensuring that that MSI Installer file had Admin privileges before installing
if pip is not installed you can use easy_install.exe to install pip and other modules
you can find easy install in
python -m easy_install pip
I had the same issue:
Installed Python 27
Tried to use pip, but failed with unrecognized command error
Checked installation: no "C:\Python27\Scripts", only "C:\Python27\Tools\Scripts"
This issue happens only on some versions of Windows.
HOW TO FIX IT:
Uninstall Python 27
Reinstall Python 27, but unselect "pip" feature
Check installation: no "C:\Python27\Scripts" as expected
Start the installer again and use "Change Python"
Set "pip" and "Add Python.exe to Path" features to be installed
Check installation: "C:\Python27\Scripts" is now correctly present
So for some unknown reason, pip is not correctly installed on some versions of Windows if it is installed during default Python 27 setup. To fix this issue, pip must be installed afterwards using the "Change Python" setup.
I meet the same issue when install Python 2.7.9. The installer does not come with pip.
Solution:
Install newer python2 x86 version: https://www.python.org/downloads/release/python-2718/
Then pip is located at C:\Python27\Scripts\pip.exe
It happens on windows as you should have admin rights to install anything on disk C.
I have the same issue Scripts folder was not installed. I would sugest to instal it on disk D.

Virtualenv not installing correctly

I had Python 3.4 running on my Windows 8.1 system during which time virtualenv used to work correctly.
Due to some requirements not working on 3.4, I downgraded my Python version to Python 2.7.6 by cleanly uninstalling Python 3.4 from C:\Python34 and installing 2.7 in C:\Python27.
Post install of python, I installed pip and used pip install virtualenv to install virtualenv for 2.7. However, whenever I run virtualenv in my command prompt, I'm faced with the following error:
sh.exe": /c/Python34/scripts/virtualenv: No such file or directory
How do I fix this so that virtualenv uses python 2.7.6 instead of 3.4?
My first hunch is to check your PATH variable:
https://superuser.com/questions/502358/easier-way-to-change-environment-variables-in-windows-8
and see if that is still pointing to a now non-existent install. Every time I've installed python on windows, I've had to manually set that, so I wouldn't assume the uninstall would fix it automatically.
Another way is to install both python 27 and 34 at different folders. You can add 27 folder to system path, and use 34 locally. If you have eclipse with pydev or other IDE tool, just configure pythonpath variable to the corresponding version that you want to use.

Categories