PyCharm errors (Can't install packages) - python

So running the "pip install" command kept throwing a "Non-zero exit code(1)" error. Then installing it through the command line would work, however, they wouldn't recognize the packages in the IDE. I then uninstalled Python and re-installed and now it recognized the packages in the IDE but when I do "import pyautogui" and then try to run a line of code it gives an error saying "no module named pyautogui" even though if I run "pip list" the package is shown as installed.
I'm quite confused and I don't know why it's not working, I've been trying to figure it out for an hour 😡😡
Also if I try to installed any package in the IDE it still gives me the "Non-Zero exit code(1)" so I can't even install anything....
Here is the actual error code it's throwing
C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\python.exe: can't open file 'C:/Users/Admin/PycharmProjects/untitled/AutoClick.py': [Errno 2] No such file or directory

Try to change the python environment in your run configuration. 👨‍💻

Related

Spyder Console databricks not defined error

In anaconda spyder, I installed databricks-cli as below
pip install databricks-cli
After installation in c:\programdata\anaconda3\Scripts, databricks.exe is showing up; but, when I run command (databricks -version), it displays below error
NameError: name 'databricks' is not defined
Could you please advise?

"py -m pip" works but "pip" returns "Fatal error in launcher"

I just installed Python 3.10.1 on Windows 11 and while following some tutorials I started with the basics of making sure everything looks right in the command prompt. I also added all the necessary data into the PATH variable.
When I run the simple command pip, the result is "Fatal error in launcher: Unable to create process using '"C:\Python310\python.exe" "C:\Python310\Scripts\pip.exe" ': The system cannot find the file specified."
However, when I run the command py -m pip I get the results I would expect when running pip.
Is there a way to fix the original command, or is this a new Windows 11 or Python 3.10.1 update of syntax?

Why am I getting "ModuleNotFoundError: No module name "pyperclip"?

I'm receiving this error although it works fine in the idle shell?
I am currently working through the Automate The Boring Stuff book.
I tried to search for which directory it was saved to but when I reach c:\users\Jibby\appdata\local\programs\python the only thing in the python folder is a folder named mu.
Edit: Apologies for not going into more detail, I already have it installed > I get this message when I try to pip install it again "Requirement already satisfied: pyperclip in c:\users\jibby\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.8.2)"
It's just that when I try to run a batch file using an import pyperclip statement, it refuses to acknowledge that I have it installed. That's what I was trying to show in the Error Code photo by showing it imports fine in the IDLE shell but doesn't work when trying to run said batch file.
My error:
You have to install pyperclip from cmd with
pip install pyperclip
Be sure to read Appendix A for how to install third party modules (including pip)
try to type into the command promt:
"pip install pyperclip"
https://pypi.org/project/pyperclip/
Got it to work by typing in "py -m pip install pyperclip" into the command line.

How to fix "No module named 'encodings'"

Before today, I only had a Python37-32 directory when it comes to python. I had to install python 2.7 for something, and now everything has broken.
After downloading the latest python release and clicking "update current installation" (or something along these lines), I was expecting I would have my old python back. However, I am now missing all of my imports. When trying to reinstall them with py -m pip install <package>, I ran into this:
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Whenever I typed "py" into my VScode terminal (and normal command prompt), I would get this error. What have I accidentally done to mess up everything?
I didn't "fix" my problem
I decided I should uninstall both Python2.7 and Python3.7, then reinstall the latest version. I have. It's working fine now, albeit I will need to reinstall many packages!

Installing Kartograph / GDAL / Etc. with PIP and virtualenv

Running into a few different problems here. Trying to install Kartograph and first installing dependencies. Here are my steps and results thus far:
Install GDAL from .pkg. Goes well. No problems here.
Try to install Kartograph using the default instructions for OSX with several packages. This fails with the following errors:
File "", line 4, in
main.gdal_config_error: [Errno 2] No such file or directory
Command python setup.py egg_info failed with error code 1 in
/Users/chris/ENV/build/GDAL
Ok, no dice. So then I try the install excluding GDAL as that seems to be presenting a problem to pip's install of Kartograph. That doesn't work either and produces the following errors:
raise KeyError('please set the environment variable PROJ_DIR to point to the location of your proj.4 installation')
KeyError: 'please set the environment variable PROJ_DIR to point to
the location of your proj.4 installation'
---------------------------------------- Command python setup.py egg_info failed with error code 1 in /Users/chris/ENV/build/pyproj
Now, I've edited the activate script of my virtualenv with the PYTHONPATH variable assignment per the Kartograph documentation. However, not sure that helped or has changed anything.
Has anyone run into a similar sequence of errors and if so, how did you solve this issue?
I managed to fix this error but now I'm stuck at another error.
Anyway this is what I did:
I installed the PROJ framework package from here:
http://www.kyngchaos.com/software/frameworks
Then I ran the following in Terminal to add the installation path to PROJ_DIR (as instructed in the error message):
$ export PROJ_DIR=$PROJ_DIR:/Library/Frameworks/PROJ.framework/Programs
Apparently PROJ is included in the GDAL framework so maybe the first step is unnecessary.
Update: It seems the path is lost when you close Terminal

Categories