recognizing packages in python IDLE after upgrading python version - python

I have upgraded my python version(3.9.6). I have problem of not being able to use pandas in idle cause it doesn't recognise it. so as always I use
import pip;
pip.main(["install","pandas"])
cause I always have problem finding the environment in which IDle is installed in IDLE itself but gives error
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.
so I checked github link but I was a general topic about pip in cmd not for using in pip by pip.main(["install","pandas"]) in script. so my question is how to install pandas in Idle which maybe by 1. finding environment of IDLE then using pip in cmd or 2. fix pip.main(["install","pandas"]).
note that I have tried pip.main(["install","--user","pandas"]) and also tried import sys;print(sys.executable) to find IDle's path and after that tried to chdir the directory in cmd to there then use 'pip install pandas' but didnt work.

I tried pip3.9 install pandas and it did work.

Related

Unable to import numpy/pandas/matplotlib packages in VScode

I have used widely used packages(installed via pip) for a while in Jupyter notebook without any issues. I tried to do Python coding in VScode,but it somehow cannot load those packages.
I have tried changing python interpreter, but it did solve the issue. Does anyone know how to resolve this issue?
First make sure that you have the python interpreter installed on your computer. In your vscode UI you should see a terminal. You can install and upgrade pip through there if needed by using these commands:
pip install --upgrade pip
From here you should be able to import using pip commands.
Hi you can use terminal for installation.
otherwise you can anaconda iDE its very good tool and user friendly.

Cannot install reportlab in pycharm(venv) on macOS

The problem
Right now I am trying to set up a virtual development environment on a macOS in pycharm.
The issue that I am facing is with this command
pip install -r requirements.txt
I am using python 2.7 right now and I am needing to install reportlab==2.4
I also get an error message when I try to install reportlab outside of pycharm and outside of my venv, that is if I explicitly do
pip install reportlab==2.4 in the terminal
I will include some of the screenshots of the errors but it is about 800+ lines of output going through the process of copying, creating, and displaying syntax error messages/other errors.
Something else that I have noticed is that a lot of the errors start with 'cc' which might be an issue because I am writing in pycharm on a mac and there might be some dependencies that I am missing/I don't have support for C code somewhere? I have installed xcode command tools already but the version of gcc might be too new/too strict? the version is xcode-select version 2384
I have tried a lot of things to get this working but cannot seem to crack it.
I will try to answer questions as I see them but in the meantime, if you have any suggestions, I am open to anything.
Thanks!
** UPDATE **
I did see that most of these were just warnings.
I managed to find a command that suppressed these warnings and allowed reportlab==2.4 to install correctly.
CFLAGS="-Wno-error=implicit-function-declaration" pip install reportlab==2.4

EnvironmentError when trying to install tensorflow-nightly in venv in PyCharm

My problem is already mentioned here, however I don't know how to do it in my venv using PyCharm. I set up a venv in PyCharm as follows:
Normally if I want to install a package I click on + search for it and install it. So tried for tensorflow-nightly. However, when trying to do so, I get the following error:
Now I don't know what to do. I want to install this version into my venv. How to do that? Where should I run pip install tf-nightly --user to make it available in my venv? When I try to run this in PyCharm I get an error: SyntaxError: invalid syntax.
When installing it, does this change my Python version?
Do you have any Python processes running in PyCharm (debugger?) or outside of it which are using this specific venv? Looks like you do and this process is using numpy.
When you are trying to install tensorflow pip attempts to uninstall numpy first as the current version is not compatible with the desired tf version. Uninstallation clashes with the Python process which is holding some numpy files resulting in permission error and half working numpy as a result.
Check the package list, is there ~umpy package? I remember seeing a similar issue with matplotlib and it manifested itself in ~atplotlib package after a failed uninstallation attempt.
Long story short - stop all Python process running and:
either manually remove d:\tfexam\venv\lib\site-packages\~umpy and install tf again
or recreate the venv from the scratch
Where should I run pip install tf-nightly --user to make it available in my venv?
You are supposed to run it in the terminal with the activated venv. Though, it is a non-relevant suggestion in this specific case. Anyway, I would suggest reading some docs about pip and virtualenv management if you are not familiar with them, as these topics are essential and will save you the trouble later.
tf-nightly is an unstable version.
Use this:
pip install --upgrade tensorflow
And verify install
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

No module named 'ffnet' in Python

I try a python code for signature recognition, and there is an import ffnet module (from ffnet import mlgraph, ffnet), but I got an error when I run it.
The error is:
ModuleNotFoundError: No module named 'ffnet'
I have install the module, but still got that error
Help me to fix this :)
You need to make sure that it is correctly installed. The error message means directly "You haven't installed it properly".
Depending on what Python version you're using, you should have a package manager called pip that takes charge of installing and uninstalling modules. Try:
pip2 install ffnet if you have Python 2.
pip3 install ffnet if you have Python 3.
Alternatively, you may have installed Python using Anaconda. In this case, use conda install ffnet. In all cases, run the proposed commands in a terminal.
However, it would be quite useful to have more details about your problem (what OS do you have, how and where did you install Python, what version do you have).
There is great chance that the pip (i suppose you use pip for installation, the idea is identical) you use to install ffnet is not correspond to the python you are using. Maybe a virtualenv is running, or you using python 2 but ffnet is installed with pip3
My suggestion:
- Run which pip. Run which python. Compare the results if anything seem wrong (python2 pip3 for example). Try to run python2 and pip2 instead of python and pip
- If the above suggestion doesn't work, you should try to recheck your PATH: Find the pip correspond to your current python (usually within the same dir) and export PATH=/path/to/THAT/pip/:$PATH
- If the problem still persist, I suppose your pip file's first line (for specifying its corresponding python path) has been modified without your awareness. You will have to manually edit it to something like #!/usr/bin/python3
Hope this help!

How do you install PyCallGraph / use pip?

and thanks to anyone who gives some of their time to consider my problem.
What I need help on is for someone to give me a simple and accessible explanation on how to install that module. I have never, ever used anything from PyPi before, I have only heard of pip after looking up PyCallGraph.
I'm not a programmer first, I'm doing an accounting internship and am using python to write scripts to help me speed up some processes, at the urging of a colleague who himself uses python. I write scripts using Notepad++ and execute them through IDLE.
I'm currently working on optimizing a script I wrote and came upon PyCallGraph while checking this very site on tips on how to do so.
I tried the very minimalistic instruction of just doing "pip install pycallgraph" just about anywhere I could think of, including cmd.exe, to no avail. Runing get-pip.py directly seems to have worked for installing pip, though.
Otherwise I can always just stick with the cProfile printout and write-off using modules needing such an install, although that saddly seems to be quite a few...
Step 1: Install PIP
Open terminal (cmd.exe, PowerShell, whatever)
Download get-pip.py and place it in the working directory of your terminal
Install PIP by invoking python get-pip.py
Confirm that PIP was installed correctly by invoking command pip (should display help if success)
If pip didn't work, make sure your PATH environment variable has been set up correctly. In typical Windows installations pip is installed under c:\Python27\Scripts. Make sure this folder is included in PATH.
Step 2: Install your library with PIP
Invoke pip install pycallgraph
PIP installs the library and it can be now used from Python

Categories

Resources