pip installs to hidden (?) directory? - python

So, I've installed xlsxwriter via pip just fine -- scripts run no problem. My issue is that I can't find where the actual files are installed to (because PyCharm IDE doesn't detect that xlsxwriter is actually installed and has that annoying red underline)
So, as you can see in the attached picture, when I run pip uninstall xlsxwriter it is showing that it's installed in \lib\site-packages\xlsxwriter\
but that folder simply does not exist as far as I can tell, not even as a hidden directory.
In the end, I really just want PyCharm to stop underlining modules that are installed, but this appears to be the case with a few different modules and I just want to get to the bottom of it.

Related

Packages installed via Pip do not get imported in Python VSCode [Windows 10]

Trying to install new packages via pip on Windows, but after it installs - Python cannot resolve the import. For Example, I have just installed the Python package similaritymeasures and pip correctly installed it, but when I import it into my Python program, it cannot find the import. Has anyone know a way around this?
Make sure that you restart VSCode after downloading your package. Sometimes, when you download a package while VSCode is still running, it doesn't recognize the package when using import similaritymeasures.
If that didn't work, then make sure that VSCode is using your preferred version of python. It is possible that you have more than one python version and it's using a non-compatible one to run your code. This can be done at the bottom right corner of the window by clicking the box that says: (for example) 3.9.5 64-bit. Then select a different (preferably older) version from the pop up widnow.
These are the solutions that came to my mind, I hope this helped.

pycharm cannot see the module "openpyxl" even though i installed

I am trying to write a python-script to work with dataframes imported from excel table and another one from another source. In order to read excel file into a pandas dataframe i selected "openpyxl" as a preferred engine, however PyCharm claims there is no such module - even though I have earlier installed it.
I am working on conda and i tried to install it both using pycharm terminal and my macbook terminal: when i retype "conda install openpyxl" it returns me
"# All requested packages already installed."
So please help me because it confuses me that PyCharm keeps screaming
"ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl."
while terminal says i already have that module installed
This may happen because your pycharm is using a different interpreter than your command line.
To solve it:
In Pycharm, go to File, settings, project Interpreter, in the right top corner click the + button. Search for openpyxl and click Install package to install the latest version of the package.

(Python)When installing pip, preferences-->project interpreter <PLZ>

For example, I installed (pip install pandas) on terminal on MacBook.
I could import pandas well in Idle, but when I imported pandas on Pycharm,
there's red line below pandas, and it did not work.
So, I went to preferences ->Project interpreter-> and then I installed pandas (by clicking + button). After that, everything worked.
My question is do I have to do that process whenever installing pip on terminal?
installing pip on terminal is not enough ?
It is very common for Python developers to use multiple virtual environments for different projects as they might, e.g. want to install Python 3.8 for one project, but for another they're using libraries that don't yet support 3.8.
PyCharm allows you to choose, and even create, a virtual environment for each project. You control that for the project at the Project Interpreter screen that you already know. You don't have to use a different one for each one but you have that option.
Apparently the default environment that you used to install Pandas in Terminal is not the same as the default you chose in PyCharm. Now you know that. PyCharm also has its own terminal (click the Terminal tab at the bottom-left of the IDE) and if you use that to pip install it will do so into the environment that you are currently using within PyCharm.
If you're always working in PyCharm, you can get used to the idea of installing inside PyCharm for the sake of simplicity.
You might want to take some time and read the PyCharm documentation here as that goes into much greater detail that I can about how to use different types of virtual environments.

Complete reinstall python, pycharm, qgis

My python installation is a mess.
Therefore I'd like to reinstall the entire installation of it. (Unfortunately,) I've also installed QGIS and PyCharm (mostly making it a mess) and I want to start clean..!
So, what is the best way to get rid of every little python thingy and what are the best packages/methods for reinstalling Python27, QGIS and PyCharm? Should I go for osgeo or not, should I first install Pycharm or Python etc. Hopefully you have some good thoughts and tools on this. I'm a fan of pip, so in the end I hope its possible just to use pip for installing the packages all around.
I'm working on Windows 7, 64bit (thanks for the headsup Karel)
Go to add/remove programs in windows and uninstall everything. Then reinstall everything. Do your Python install first and PyCharm should detect everything. I'd suggest doing the 32 bit Python install as some packages aren't compiled for 64 bit and it makes things a bit challenging to find and install them.
Pip is standard in the python install now. You'll see a check box in the installer for it, which is pre-checked. I'd change your install directory to something simple like C:\Python27
Other than that it should be pretty straightforward. However I doubt you really need to uninstall Python. You can just go to settings and under the interpreter section add the C:\Python27 directory. PyCharm is constantly scanning for installed modules, so it will know in real time that you've installed them. You can even install packaged via PIP while PyCharm is open and within second PyCharm will recognize it as a valid package.
If you're missing packages you can also import them in PyCharm and when you get the red underline saying it's missing, hover your mouse over it and hit alt+enter and you'll get a menu to install it.

Python - how can I change default path when installing modules?

I'm trying to install a Python Module by running a Windows installer (an EXE file).
The Problem is that the default python folder and the defualt Installation Library are set To disc D:\ and are grayed out (meaning I can't change it). It might be fine is some places, but in my computer, D is the DVD drive, meaning that no installation is possible.
Is there any way to change this or to overcome this?
It's not "default folder", and there's a reason there's "found in registry" next to the version. You need to re-register the Python installation if you've moved it, either by installing it again (without removing) in the same folder, or changing the directory saved in registry (HKCU\Software\Python\PythonCore\X.X\InstallPath, possibly on Wow3264Node) either manually or using registration script.
Because what you're installing (you don't say what it is) seems to be standard distutils-generated installer (as Cat Plus Plus points out in his comment) you don't have to install it by running installer. You can install it using easy_install program what allows you to choose which Python to use. See my answer to Can I install Python windows packages into virtualenvs? question.
EDIT
Now I see in your comment you're installing setuptools. This complicates things a little bit as this is the package which contains easy_install tool I mentioned above. You have chicken/egg problem here... There's solution for this, however. You can use ez_setup script to install setuptools without using exe installer.

Categories

Resources