Why cant I use my newly downloaded python library? - python

So ive tried to install customtkinter and the installation was successfull
Using cached customtkinter-4.6.3-py3-none-any.whl (246 kB)
Requirement already satisfied: darkdetect in c:\users\omen1\appdata\local\programs\python\python311\lib\site-packages (from customtkinter) (0.7.1)
Installing collected packages: customtkinter
Successfully installed customtkinter-4.6.3
But when i then go to vs code and write import customtkinter and run it says
Traceback (most recent call last):
File "c:\Users\OMEN1\OneDrive\Skrivbord\python projects\database.py", line 290, in <module>
import customtkinter
ModuleNotFoundError: No module named 'customtkinter'
I have tried to uninstall and re-install
My pip is also fully uppdated aswell as my python 3.11
Ive tried multiple things

Ensure that the interpreter you're using in VSCode is aligned to where you installed the library.
For example if you installed it with Python3, your VSCode may be pointed to Python2 instead.
Additionally, according to the PyPi link for that library - "To use CustomTkinter, just place the /customtkinter folder from this repository next to your program, and then you can do import customtkinter."

Related

Unable to import psutil in python3 with cygwin [ImportError: no os specific module found]

I've been trying to import the psutil module from cygwin (as a Linux alternative for Windows 7). The installation worked, though.
When re-installed, it showed:
Requirement already satisfied: psutil in /usr/local/lib/python3.8/site-packages (0.1.3)
But when imported, it gave:
>>> import psutil
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/psutil/__init__.py", line 61, in <module>
raise ImportError('no os specific module found')
ImportError: no os specific module found
I tried a couple of things:
Upgrading the pip and psutil itself, using these commands:
python3 -m pip install --upgrade pip
pip3 install --upgrade psutil
so the current version:
Requirement already satisfied: pip in /usr/local/lib/python3.8/site-packages (21.2.4)
Requirement already satisfied: psutil in /usr/local/lib/python3.8/site-packages (0.1.3)
Made sure that packages are installed only in the python 3.8.10 version (I have multiple versions of python installed, so I figured the inconsistency of versions may be causing the problem. But still, it didn't help).
Though, what I've done so far is just making sure I'd type an extra "3" after each python-related command.
I'm still new to cygwin and python, any help would be very much appreciated, thanks!
I may be wrong here, but I did some digging, and it looks like they have been trying add cygwin support for psutil since 2010, see github page for psutil issue #82. Looks like there is no support for now.

No module named 'PyQt5.sip' even if I just installed it

I am using Ubuntu VM and trying to run a GUI script - this is the entire repo and this is the script. Apparently I didn't need to install PyQt5, because it said Requirement already satisfied: pyqt5 in ./.eggs/PyQt5-5.14.2-py3.8-linux-x86_64.egg (5.14.2)
Requirement already satisfied: PyQt5-sip<13,>=12.7 in ./.eggs/PyQt5_sip-12.7.2-py3.8-linux-x86_64.egg (from pyqt5) (12.7.2).
However, when running the script, I got the error:
Traceback (most recent call last):
File "Scripts/CellModellerGUI.py", line 9, in <module>
from PyQt5.QtWidgets import QApplication
ModuleNotFoundError: No module named 'PyQt5.sip'
So I installed it with pip, but I get the exact same error.
I tried pyqt5-sip, too, but "Requirement already satisfied" appeared again.
It's possible that your pip and python are not linked to the same version. Try doing pip --version and python --version and see if the Python versions match (not the pip version, but the Python version it says it's linked to)

pip Installed biopython, but it won't compile Bio Module

I have biopython installed, but it keeps saying no module named Biopython
I had this working previously so I know it works, but I wanted the program to compile on a different computer. I installed python on the computer (version 3.7.3) and installed Pycharm Community Edition as the IDE. After that I installed pip and did the following in the pycharm terminal:
pip install biopython
Output:
Requirement already satisfied: biopython in c:\users\thisi\appdata\local\programs\python\python37\lib\site-packages (1.73)
Requirement already satisfied: numpy in c:\users\thisi\appdata\local\programs\python\python37\lib\site-packages (from biopython) (1.16.4)
Yet, whenever I compile the program, I get the following error.
C:\Users\thisi\AppData\Local\Programs\Python\Python37\python.exe C:/Users/thisi/Desktop/H-protein/py-scripts/protein-blastp.py
Traceback (most recent call last):
File "C:/Users/thisi/Desktop/H-protein/py-scripts/protein-blastp.py", line 1, in <module>
from Bio.Blast.Applications import NcbiblastpCommandline
ModuleNotFoundError: No module named 'Bio'
Process finished with exit code 1
I have browsed the internet for hours to find a solution, but none seem to work as they are tailored to linux.
Other Relevant Details:
My OS is Windows10
If I open the project interpreter, it shows biopython package installed in my current project and python 3.7 as the interpreter. Any help would be appreciated.
from Bio.Blast.Applications import NcbiblastpCommandline
I just need the first line of code to compile
The function I gave is an example of how I use the biopython package

CLIPSpy: Getting "No module name 'clips._clips'" upon importing clips

I have installed CLIPSpy from the git repository, and followed the instructions for installing with the source files. Yet after installing and running the python shell I get this error:
`import clips
.../clipspy/clips/__init__.py", line 30, in <module>
from clips.error import CLIPSError
.../clipspy/clips/error.py", line 32, in <module>
from clips.router import Router
.../clipspy/clips/router.py", line 7, in <module>
from clips._clips import lib, ffi
ModuleNotFoundError: No module named 'clips._clips'`
Despite this error, if I run the same commands outside of my CLIPSpy directory, I can import clips but get a different error.
>>> import clips
>>> env = clips.Environment()
>>> env.assert_string("(test 12)")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Environment' object has no attribute 'assert_string'
My assumption is that ModuleNotFoundError may be responsible for the AttributeError.
OS: Arch Linux
git-repo: https://github.com/noxdafox/clipspy
I followed the advice of specifying the directory of clips, using pyclips and import clips as a python module, to specify the location of clips but it still gives me the same error.
Installing CLIPSpy via pip gave 'satisfactory' results: ModuleNotFoundError: No module named 'pygame'
Requirement already satisfied: clipspy in /usr/lib/python3.7/site-packages/clipspy-0.3.2_2_g7dd9ca2-py3.7-linux-x86_64.egg (0.3.2-2-g7dd9ca2)
Requirement already satisfied: cffi>=1.0.0 in /usr/lib/python3.7/site-packages (from clipspy) (1.12.2)
Requirement already satisfied: pycparser in /usr/lib/python3.7/site-packages (from cffi>=1.0.0->clipspy) (2.19)
I tried re-installing clipspy via github many times, but the same issue persists. The interesting part is that I used pyclips as alternative for a while and it gave me the same error. It might be something to do with the directory or the installation, but I am not sure what it could be.
The installation process for CLIPSpy was as follows:
make:
python setup.py build_ext --include-dirs clips_source \
--library-dirs clips_source
/usr/lib/python3.7/site-packages/setuptools/dist.py:484: UserWarning: The version specified ('0.3.2-2-g7dd9ca2') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.7/_clips.c'
already up-to-date
I tried re-installing setuptools to see if I could get a valid dist.py version, but alas nothing has changed.
sudo make install:
....
Installed /usr/lib/python3.7/site-packages/clipspy-0.3.2_2_g7dd9ca2-py3.7-linux-x86_64.egg
Processing dependencies for clipspy===0.3.2-2-g7dd9ca2
Searching for cffi==1.12.2
Best match: cffi 1.12.2
Adding cffi 1.12.2 to easy-install.pth file
Using /usr/lib/python3.7/site-packages
Searching for pycparser==2.19
Best match: pycparser 2.19
Adding pycparser 2.19 to easy-install.pth file
Using /usr/lib/python3.7/site-packages
Finished processing dependencies for clipspy===0.3.2-2-g7dd9ca2
The solution could be something simple, but I can't seem to know what it is.
Any help or advice on what to do or where I went wrong would be greatly appreciated.
EDIT 1:
After removing files related to clips, and having a fresh install, I no longer receive the Atribute Error. Rather I get an ImportError
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/clipspy-0.3.1-py3.7-linux-x86_64.egg/clips/__init.py", line 30, in <module> from clips.error import CLIPSError
File "/usr/lib/python3.7/site-packages/clipspy-0.3.1-py3.7-linux-x86_64.egg/clips/error.py", line 32, in <module> from clips.router import Router
File "/usr/lib/python3.7/site-packages/clipspy-0.3.1-py3.7-linux-x86_64.egg/clips/router.py", line 7, in <module> from clips._clips import lib ffi
Import Error: libclips.so: cannot open shared object file: No such file or directory
I've cloned the git repository that contains tag 3.2
EDIT 2:
Managed to fix the error by renaming the libclips.so.6 file located in the /usr/lib/ folder to libclips.so
Now it works.
I am the author of the clipspy module. I would rather suggest you to open a GitHub issue for these types of matters rather than a SO question.
As a general line, the issues you are suffering from indicate you are trying to install a Python module in a dirty environment. For example, installing via pip resolves in a noop because you ran make install beforehand and pip sees the package is already installed.
To install from git, you either git clone a specific tag or download the code from a specific release. clipspy uses tags to infer the version numbers hence you see the warning:
UserWarning: The version specified ('0.3.2-2-g7dd9ca2') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
A common issue when installing clipspy is an old version of setuptools. Have you tried updating it to a more recent version?
# pip install --upgrade setuptools
One last note, do you happen to also have PyCLIPS installed within the system? The namespaces will conflict as the modules are both called clips. This would explain the error traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Environment' object has no attribute 'assert_string'

Python module error - beginner

So I'm trying to import AppKit into my python project. I am using pyCharm, but every time I try to import, I get the following error message:
You are using pip version 6.0.8, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting AppKit
Using cached AppKit-0.2.8.tar.gz
Collecting flask (from AppKit)
Using cached Flask-0.10.1.tar.gz
Collecting pygobject (from AppKit)
Using cached pygobject-2.28.3.tar.bz2
Traceback (most recent call last):
File "<string>", line 20, in <module
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3p/csss5m7x30ldjd4z0xt6sg380000gn/T/pycharm-packaging0.tmp/pygobject
I've tried running the command directly through terminal etc, and I have upgraded my version of pip to 6.1.1 as well.
Not sure if this is a really beginner's mistake that I am making, or if there is something wrong with my installs of pip or python.
Any advice would be great, thanks :D
First, "importing" and "installing" are not the same thing. Installing is how you get a PyPI package, and all of its dependencies, onto your computer, so you can use its modules. Importing is how you use a module that's already on your computer.
Second, there are two different things named AppKit, and I think you've gotten them confused.
If you're on a Mac, you're almost certainly trying to use import AppKit to get the PyObjC wrapper around the native Cocoa framework named AppKit. If you don't already have PyObjC installed (I believe it comes with Apple's built-in Python on OS X 10.8-10.10), you get it with pip install PyObjC, not pip install AppKit.
If you're on Linux or FreeBSD or similar, you may be trying to import AppKit to get the AppKit framework for building GNOME GUI apps out of HTML and JavaScript. (Although this is in early stages, so I don't think you actually do want it.) For that, pip install AppKit is what you want. But you may need to install some system packages for GNOME development first with apt-get or urpmi or whatever's appropriate for your system.
If you're on Windows or something else, neither one of these makes sense, so… hopefully you're not. :)

Categories