visual studios cant find package i installed through pip - python

Visual Studio says I'm running Python 0.0 AND 3.10
Visual Studio is unable to find a package. I am able to run it in cmd using python.
I have had this problem before, but can't remember how I fixed it. I think I'm using the wrong version of python, but if that is the problem I don't know how to fix it.
Edit: using py -3.10 -m pip install package, instead of just pip install package seems to have worked.

Check the version in cmd and then if it is something above 3.7 or so you are good to go else reinstall python and if you are on Windows then check the box at bottom of the installation window of python which says "Add pip to path" something like that
Now in the VS Code
Hit Ctrl+Shift+p to open command palette and in that search for python interpreter and change it to plain one or you may choose
Select Python Interpreter

use the vscode console
First of all to check the packages insatalled in python you have to use the pip freeze.
pip freeze
This will help you to find out if the required package which you've installed is on the list or not.
If it is not present use the same console for:-
pip install <packageName>
for eg.
pip install django
then check the list agian

Related

How can I download SciPy on Python (PyCharm app)? [duplicate]

I am using python 3.6.5 with PyCharm.
While trying to install any package, it gives the error
"Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\projectPath\venv\Scripts\python.exe'"
Project path and actual python installed paths are different.
In settings of PyCharm, pip version is 19.0.3 and latest version is 19.3.1
Also, "python -m pip --version" from command prompt says pip version is 9.0.3
What do I do?
I imagine that you have more than one Python installed in your system.
you should go to Pycharm --> file> settings> project>project interpreter.
you should find the other Python instance on your system and try to change your interpreter to that one.
if it does not appear in the list click on the button that looks like star in front of the project interpreter.
I had the same problem.
I realized that I installed one python by myself and another is installed while installing PyCharm.
After changing my interpreter I do not receive that error anymore.
This error occurred to me too when using PyCharm, and trying to install MeCab in it. And by choosing mecab-python3 instead of just mecab (which is what is for Python2 I assume...).
You might install the package compatible to the Python version used in the package, but not to yours, which is that PyCharm refers to'dir:\projectPath\venv\Scripts\python.exe' . So you should choose the different version of the package, or change interpreter to another.
I got the same error along with no such option: --build-dir after upgrading pip from PyCharm's (2020.1 #PY-201.6668.115) terminal (PyCharm didn't allow me to do so from interpreter's settings).
Turned out older versions of PyCharm rely on --build-dir which was removed in newer versions of pip. To resolve the issue I had to downgrade pip.
Solution was found here
Faced same issue after trying to change the file path.
Tried changing the interpreter location but it dint work for me. so I uninstalled pycharm and re-installed it. working fine now.
I faced the same problem on Windows-10 (PyCharm 2020.1.2 version) when installing h5py package. I didn't want to change my interpreter as that will raise other compatibility errors in my code.
In my case:
What didn't work: upgrading the pip
What worked: I chose old h5py version-2.10 (instead of the latest h5py version selected by default by PyCharm) and it worked.
Mentioning just in case if this works for someone. Uninstalling both Python and Pycharm is too much to do for this error (in my opinion).
File-> settings
searching for project -> and choosing "python interpreter"
in "python interpreter" tab choosing "show all"
pressing in the left down side on "+" (add)
adding the right direction of python installed place and press "ok"
removing the previous version
I faced the same error while using Python 3.7.5 and Pycharm 2019.1.2 for my Django project.
It also causes failure in execution of many other python commands, and is not caused by environment variables or path.
I guess it's because some python files are broken or corrupted.
The easiest and fastest way I found to get out of this was :-
Uninstall Python.
Uninstall Pycharm.
And Reinstall latest versions of both.
I had the same problem and but see solution uninstall IDLE python and pycharm and install least version
Uninstall Python.
Uninstall Pycharm.
And Reinstall latest versions of both.

Python 3.5.1 Pygame Installation

I am trying to install Pygame for Python 3.5.1, but it tells me to upgrade to the new version of pip. "You are currently using 7.1.2, use 8.1.2".
Here is a screen shot of it:
The error clearly states Access Denied.
Try to run cmd/powershell as administrator.
The installation error is not because of pip , though you should still upgrade pip
python -m pip install --upgrade pip
Pygame does not have python3.5 support yet. Check the binaries here
Pygame binaries
Try to use Python version 3.4 or 2.7 and then install pygame.
EDIT
You can find unofficial pygame binaries for several Python versions including Python3.5 here.
So if you do not find the official binary, you could try the appropriate file from the above link.
Note: The binaries given there are whl files. So you need to install them using pip.
Example: Assuming you have 32-bit Python installation, run pip install pygame-1.9.2b1-cp35-cp35m-win32.whl
See this answer for more detailed instructions.
Pip seems to be having a permission problem creating this directory: c:\program files (x86)\python35-32\Lib\site-packages\pygame
Here are some things you can try:
Navigate to that directory and see if it already exists. If it does exist, then try deleting it.
Try running pip as an administrator. Right click the command prompt icon and select run as administrator. Your path variables might not be set for the administrator, so you many need to give the full path for pip. In your python folder, it should be in a folder called scripts.
Since you're using Windows, you can also try the binary installers here: http://www.pygame.org/download.shtml
If nothing works you can try installing a different version of Python. I use Python 2.7.8 with pygame.
It was a problem based on the admin command run program and I figures it out.

pycharm interpreter using cygwin version python

I am running django python2.7 using Pycharm in windows.
Now I have some issue with redis queue not working in windows because of this
I am trying to do what this person did here. Use a cygwin version of python as pycharm interpreter.
(not sure if I downloaded all the packages or did correct steps)
I downloaded cygwin and install packages python2.7 + python-setuptools and then try to point my Pycharm interpreter to c:/cygwin/bin/python27.exe
see image
After that it seem ok and ask me to install packing tools pip, I clicked it and it give me this error:
see image
"Cannot start process, the working directory '\cygdrive\c\Users\User1G~1.SIS\AppData\Local\Temp\1\tmpYpudf2pycharm-management\pip-7.1.0' does not exist"
According to the error message it looks like pip can't be found... Are you sure you have installed pip?
Take a look here, how you can install pip: Installing Pip-3.2 on Cygwin
You can open a cygwin command line window and try to manually install the packages you want to.

How to use easy install on Canopy Enthought?

I have installed the latest version of Enthought, I have the free express version. and I want to install the pyodbc package.
I have gathered that I need to use easy_install to install pip to install pyodbc.
However, I have no luck in using easy_install or even enpkg.
If I open enthought editor and type in:
enpkg pip
or
easy_install pip
all I am getting in return is syntax errors.
(I am very inexperienced with using external packaged that are not already installed into Enthought.)
What exactly are the syntax errors? I am guessing you are typing this into the python shell shown by the enthought editor?
What you need to do is open up a command shell. Are you on Windows? Try running cmd.exe - Canopy might even provide a special shell to use (with paths all set up for you) so check the start menu.
Then, you should be able to use easy_install and enpkg. You should see a prompt similar to:
C:\Users\Sameer\>
Type it at that prompt.
The python prompt looks like this:
>>>
You can't run enpkg or easy_install from there. Well... technically you can by shelling out, but first, try the above.

How to install pip in python 3.4 on windows?

I'm really struggling at installing any python modules (e.g six, yahoo_finance) because they require pip to be installed, but I don't know whether I have pip already or how to install it. Once its installed I don't know what command to type in and where to type it in. Can I install these modules any other way without pip?
I am only a beginner, so sorry if this is a bit basic.
Thanks in advance
pip comes already bundled with python 3.4 It will be in your scripts directory C:\Python34\Scripts\
Add it to your Environment variables and you can run it from any directory or else open the directory mentioned above in command prompt and run pip install ... to install whatever you want
First, make sure you have it installed, if not follow the instructions below. Type which pip, and if it doesn't list an URL, it means it's not installed yet.
Go here https://bootstrap.pypa.io/get-pip.py and download the file.
Then open terminal and go to your downloads folder (or wherever you downloaded it to) and type python get-pip.py to execute the script. If you get an error that says OSError: Permission Denied, or something similar, run it with administrator permissions.
If the installation is successful, you should now have pip installed on your computer. Type pip --version to make sure you have it installed.
To install six and yahoo_finance, type:
pip install six
and
pip install yahoo-finance
If something goes wrong update your question.
From Installing Python Modules:
pip is the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers.
Emphasis mine
If you already installed it by default you should be able to use it.
Just open the command line and type python -m pip install SomePackage.

Categories

Resources