Why Cygwin can't find installed modules of python on windows? - python-3.x

After clean installation of Windows 10, I installed Python 3.7.1, and at the end of installation I chose to add it to Path Variables, which was asked in the options if I want to. Then I installed Cygwin, after which I did pip install --something inside Cygwin. But When I tried to import that module it throwed error cant find module.What is happening here?

You are mixing the installation and that does not work. If you need Python inside cygwin use its own version.
The last version of Cygwin Python 3 is 3.6.4-1
https://cygwin.com/packages/x86_64/python3/python3-3.6.4-1
If you need to upgrade the Windows installation run pip from outside the Cygwin enviroment

Related

I have a M1 Pro MBP and was trying to upgrade my default Python from V3.8.8 to V3.11.1 but now can no longer "see" any packages in Anaconda

In changing the symlink to V3.11.1, I've "lost" access to all Python packages installed under 3.8.8. Aanconda can't find any modules either, either under 3.8 or 3.11 and won't let me reinstall Anaaconda.
At the terminal prompt, I can get to V3.11.1 via Python3 command (not Python) and can see a list of modules but none of the packages previously installed. Tried to reinstall Anaconda but the installer says to upgrade instead. When I try to upgrade at the system prompt, "conda" isn't recognized.
I'm know my references are all messed up but not sure how to get my environment working. Appreciate any help/suggestions.

Spyder, clean Win installation, ver. 4.2.3 - pip gives message "No module named pip"

I have Spyder, clean Win10 installation, ver. 4.2.3.
When I run command pip, it gives message:
Note: you may need to restart the kernel to use updated packages.
C:\Users\UserName\AppData\Local\Programs\Spyder\Python\python.exe: No module named pip
I restarted Spyder, Win10, nothing helps.
How to fix it?
Thanks.
(Spyder maintainer here) We don't provide pip in our Windows app to prevent people breaking Spyder by installing any kind of packages with it.
The best way to use other packages that don't come with our app is to install Miniconda, create a conda environment after that with the packages you want to use and spyder-kernels, and finally connect Spyder to that env.
If you have python 3.4+ then pip should be installed with python.
To check that, you can run
pip help
in your windows command line.
However, if it isn't the case then download the get-pip.py file and run
python get-pip.py
and the pip installation should start. You can use pip help to verify this.
Another source of the problem might be that pip isn't listed in your PATH variables and thus isn't recognized by your command line.

Python Can't Use Pip After Uninstall 3.9

Problem
I Uninstalled Python 3.9 as I tried to import matplotlib
and would not work. After looking around for solutions I found out matplotlib may not be supported with 3.9 OK no problem. I'll uninstall 3.9 and install 3.7 Once done I tried to pip install matplotlib and the problem underlined in green (In photo). Happens I've change the environment variables as shown (In photo) and when I go into the file only 3.7 is there. Not sure why it's doing this maybe someone ran into the same issues as I but it was working fine until I uninstalled 3.9 I will keep it updated until CMD problem is sloved.
Solutions I Tried
Uninstalled and Reinstalled (From installer itself)
Remove environment variables and add environment variables again
Restarted Terminal and Computer
Repair Installation
where pip OUTPUT: "C:\Users\name\PycharmProjects\pythonProject\venv\Scripts\pip.exe C:\Users\name\AppData\Local\Programs\Python\Python37\Scripts\pip.exe)"
Change Environment Variable name from Python to Path
Update
I downloaded anaconda and using the powershell prompt and it seems to work now, but with the default CMD it does not work.
Solution Fixed for CMD
Found out pycharm projects did not remove the script files from 3.9 and had to go in manually and remove it C:\Users\name\PycharmProjects\pythonProject\venv\Scripts once any 3.9 scripts where removed I was then able to use pip as normal. Recommend either uninstall Pycharm or (IDE) and reinstall with correct interrupter I'f you're switching from 3.9 to lower.
Photo's
Here was the: Problem with CMD
Here's the: Solution Fixed with anaconda
Here's the: Solution Fixed with CMD
Try executing python -m pip install package
If you are in Linux, execute whereis python and then add a version to the PATH, then you can execute the pip as well.
Other way is to install a new version. PIP only works with a version of python installed

autopep8 not found in cygwin

If I try to use autopep8 in cygwin (64bit, WIndows10) i get the message "command not found".
$ autopep8
-bash: autopep8: command not found
I tried pip install autopep8 but pip is also not found, only pip2 and pip3.
If I use python -m pip install autopep8 it works so I can call
python -m autopep8
but I want to run a script where just autopep8 is called:
if ! type -p autopep8 >/dev/null; then
echo "autopep8 not found" >&2
autopep8() {
Any ideas how to solve this?
First, you must install PyPi packages to the correct Python installation, and second, you must install the same package to every Python installation in which you want to use it.
Now, a special note about installing Python on Cygwin. You have a choice of several Python versions to install, and scores of packages for use with each of those versions. Avoid Python version 2 unless you have a clearly define reason, as it is post End-of-Life. Instead, install one of the versions of Python 3. As of today, version 3.6 and 3.7 have the more complete sets of optional packages. Version 3.8 beta 4 is available.
For a my install of Python 3.8, I used the Cygwin setup app to install these packages: Python38 (Py3K language interpreter), Python38-pip (Python package installation tool), Python38-setuptools (Python package management tool), Python38-virtualenv (Creates isolated Python environments), and Python38-wheel (Python package format module). To write X11 GUI apps, add Python38-tkinter (Py3K Tkinter GUI module). To install binary packages, add Python38-devel (Py3K language interpreter).
You will be able to install pure Python packages from PyPI. To install binary packages you will also need to have the GNU compiler tool chain installed, and you will need to handle dependencies with other Cygwin packages on your own.
The Python 3.6 and 3.7 installations have addition packages which, in many cases, contain binary packages with the above mentioned dependencies already resolved, or have some useful customizations for the Cygwin environment.
Cygwin has both Python 2 and Python 3. As of today, after installation, you execute Python 2 by python and Python 3 by python3. Be careful which Python you execute as you may get a windows version of Python, if installed, and in your path. which python will always tell where the executable lives, and python -V, etc., will tell you which version you are running. Generally, you want to run a Cygwin version of Python from the bash prompt and Windows versions of Python only from the command prompt or windows GUI.
The safest way to use pip is to use the module version for the Python executable you have chosen, i.e., python -m pip, etc. This avoids having to also remember to use pip with Python and pip3 with Python3.

can't uninstall python3 in macOS

I am having trouble with my current python, so I wanted to uninstall my python and install the latest version. I installed with homebrew, so I uninstalled it with homebrew and reinstalled python 3.8.1 with the installer from the official site. Python3.8 was installed, but my python3 was not upgraded.
~ which python3
/usr/bin/python3
~ python3 --version
Python 3.7.3
I know I'm not supposed to(and I can't) manually delete things inside /usr/bin. What am I supposed to do?
When you installed Python with homebrew it told you this:
Unversioned symlinks python, python-config, pip etc. pointing to
python3, python3-config, pip3 etc., respectively, have been
installed into /usr/local/opt/python/libexec/bin
If you need a reminder, post install, you will get the same message if you run:
brew info python
It says "unversioned links are in /usr/local/opt/python/libexec/bin". That means, if you want to run Python without specifying the version, i.e. if you want to type this:
python
and this:
pip
to start Python 3 and its corresponding pip, you need to make sure your PATH has /usr/local/opt/python/libexec/bin at the start, i.e.
export PATH=/usr/local/opt/python/libexec/bin:$PATH
I could not uninstall the python3 in /usr/bin but found a workaround to give the python3 in /usr/loca/bin precedence by setting the PATH env variable as PATH=/usr/local/bin:$PATH. This gives binaries in /usr/local/bin precedence. Not a full fledged solution, but got me moving.

Resources