kneed installation issue: ModuleNotFoundError: No module named 'kneed' - python-3.x

I need to use from kneed import KneeLocator for Knee-point detection in Python, but everytime I try to import the module after closing the Jupyter notebook I always get ModuleNotFoundError: No module named 'kneed' error and I am forced to install it again. I am using Jupyter Notebook with Anaconda on a remote server that I do not have the access to. I am using its web client.
The module I am trying to install and use is from https://github.com/arvkevi/kneed
I have not faced this issue with any other libraries. All other libraries I just need to install just once.
What could be the reason behind that?
Could anybody help me understand why is it happening and how to solve this issue?

You might need to run this line of code first. That worked for me
!pip install --upgrade kneed

According the information you provide, you are using python3.X . try "python3 setup.py install" instead of "python setup.py install".
After you install the module, run python3 -c "help('help;)" to confirm you install the module successfully.

Related

Could not install module (runpy issue)

When trying to install a Python module on the Qualcomm® QCS610, some error messages occur. Python3 is used and the following commands are tried:
Python3 -m pip install tensorflow
**python3 -m pip install tflite **
The same error message comes up no matter what module is tried to install:
"Could not import runpy module
ImportError: No module named 'runpy'"
I thought ,I don't have access to the internet with myboard and assume Python wants to download the module over the internet. So I have found a way to download a module from My PC and then transfer it to the board using WinSCP and then install it from there as well.
I download the module "tflite-runtime" and keep it in Root .
By using " python3 -m pip install tflite_runtime-2.7.0-cp39-cp39-manylinux2014_x86_64.whl -f ./ --no-index"
By using this command , "tflite-runtime" module should have be installed ,however still showing same errros.
" Could not import runpy module
ImportError: No module named 'runpy'"
If anyone has an idea to solve this problem I appreciate it.
Thanks.
Deniz

Can't import 3rd party python module

I would like to preface with the fact that I am a coding newbie and all this is very new to me. In fact, this is my first stack overflow question.
Anyways I am learning python and am trying to install my first third party module called “pyperclip” in Terminal, but I don't think it installed correctly. I am very new with Terminal as well.
For reference, I am following the youtube guide "Automate the Boring Stuff with Python"
https://www.youtube.com/watch?v=xJLj6fWfw6k
I am on Lesson 8 and I am at minute 3:43 in the video if you want to follow along.
Here are some of my system details:
Mac OS X
Python version 3.8.3
I ran the following into Terminal:
sudo pip3 install pyperclip
Then I received the following message in Terminal after installing pyperclip
The directory or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
I then tried to install again using the following:
sudo -H pip3 install pyperclip
Then I got this message:
Requirement already satisfied: pyperclip in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.8.0)
I tried installing one last time using:
pip3 install pyperclip
I got the same message again:
Requirement already satisfied: pyperclip in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (1.8.0)
This is also the error I get when I try importing pyperclip in my interactive shell:
>>> import pyperclip
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
ModuleNotFoundError: No module named ‘pyperclip’
>>>
Can anyone help me please? I feel like a fish out of the water with all this stuff. Especially when it comes to Terminal. Any help would be greatly appreciated.
I wanted to discuss a few things that might help you on your way.
We typically do not use sudo in conjunction with pip to install Python packages. This installs the package at a system level and could conflict with packages that your system currently has installed or may install packages to a Python installation which is different than the one you are using from the terminal. Instead, we typically use pip install --user rather than sudo pip install.
See this question and answer for more: sudo pip install VS pip install --user.
If you are ever unsure whether a package has been installed properly, check using
pip3 list
We also need to make sure that the Python interpreter you are using is the same as where pip is installing. Since you are using pip3 to install, you should be using python3 at the terminal to enter the interactive shell. You can also verify that you are using the right Python interpreter by typing in the following command into the terminal:
which python3
Then, make sure that the output matches with the /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ path that was reported by pip3.
If you are using a different interactive shell such as ipython, you need to make sure that you install ipython in the same manner using
pip3 install --user ipython
and executing it using
ipython3
Try repeating your steps using this new information to see if it helps. Let me know if you have any more questions or need some more help.

ModuleNotFoundError: No module named 'cv2.ximgproc

When I am running the command from cv2.ximgproc import guidedFilter, I am getting an error: ModuleNotFoundError: No module named 'cv2.ximgproc'
I searched the Internet for possible reasons, and I found out that I should run a command pip install opencv--contrib-python on the terminal, which I did. Even after doing that, I am getting the same error.
Please note that I am not very good at programming and technical stuff, so please explain in simple terms. I have a mac, and I am using Anaconda for writing my codes.
You need to uninstall the regular opencv package first.
First uninstall both regular opencv as well as contrib package:
pip uninstall opencv-python
pip uninstall opencv-contrib-python
Then install the contrib package:
pip install opencv-contrib-python
You can refer to this post for more information:
Module 'cv2.cv2' has no attribute 'ximgproc'
I have written a python script as follows:
from cv2.ximgproc import guidedFilter
print("hello")
Initially it was giving me the same error : 'ModuleNotFoundError: No module named 'cv2.ximgproc'. But then i ran the command "pip install opencv--contrib-python" and after that it prints "hello" i.e it is detecting the ximgproc module.
please check the below screenshot.
Check once the installation of opencv--contrib module. There is some problem at that stage.

PyCharm doesn't Splunk SDK (splunklib)

I have a simple python script that calls the Splunk API. For this, I include splunklib:
"import splunklib.client as client"
This script works very well, when I start it from a terminal window (MacOS): python3 main.py
For this, I had to install splunklib using "pip3 install splunklib".
Unfortunately I can't run the same script out of Pycharm.
I also successfully installed splunklib under settings/Project Interpreter/Package. splunklib is shown in the list of installed packages for the Project Interpreter (splunklib 1.0.0, Python 3.7).
When I run the script using Pycharm, I get the following error message:
import splunklib.client as client
ModuleNotFoundError: No module named 'splunklib.client'; 'splunklib' is not a package
Why can Pycharm not find Esplunklib, even though it's installed in the Project Interpreter?
I had this same issue today, and tried to resolve it the same as you by doing a pip3 install splunklib. Unfortunately, the splunklib package is not the one you want. I'm not sure if that is a deprecated package, or something else entirely, but what you're probably looking for is the splunk-sdk.
This should get you going; pip3 install splunk-sdk

ModuleNotFoundError: No module named 'requests'. But 'requests' already installed

Trying to import 'requests'.
Has it installed via pip3 install requests? But still, have this error.
C:\Users\Vikentiy>pip3 list
Package Version
---------- ----------
certifi 2018.11.29
chardet 3.0.4
Django 2.1.7
idna 2.8
pip 19.0.2
pytz 2018.9
requests 2.21.0
setuptools 40.6.2
simplejson 3.16.0
urllib3 1.24.1
virtualenv 16.4.0
C:\Users\Vikentiy>python --version
Python 3.7.2
Error Traceback:
C:\Users\Vikentiy\untitled2\venv\Scripts\python.exe C:/Users/Vikentiy/untitled2/requeststests.py
Traceback (most recent call last):
File "C:/Users/Vikentiy/untitled2/requeststests.py", line 1, in <module> import requests`
Try to uninstall requests and then again install it using pip
pip uninstall requests
and again install it
pip install requests
or if you didn't get what I am saying so please visit
https://scmquest.com/resolved-importerror-no-module-named-requests-usr-bin-python-no-module-named-pip-on-macos/
Another cause of this might be multiple Python versions installations. So if you type in your terminal:
pip3 install requests
The requests library will be automatically installed to your default python3, for example, Python3.6. However, let's say you have another Python version, for example, Python3.7, what you should do is:
pip3.7 install requests
This should solve this problem.
If you are running your code in the terminal, you should try:
python3.7 file_to_run.py
If you're using PyCharm as IDE, try closing and restarting PyCharm. Move the mouse cursor over the "requests" (with red curly line beneath it), until the red light bulb next to it show up. Select the first option in it, "Install package requests". PyCharm will take care of the installation from there.
I ran into the same issue and have tried all the solutions here on Stack Overflow.
If it is installed this will WORK:
c:\>python (or on Mac/Linux "$ python")
>>> import requests
>>> requests.get("http://127.0.0.1")
<Response [200]>
If you see this error when running your script/IDE:
Traceback (most recent call last): File "E:\test.py", line 1, in <module>
import requests
ImportError: No module named requests
Try:
python script.py
Answer is based on https://www.edureka.co/community/84584/python-requests-module-import-error-module-named-requests
Then the trick for me was not to start up a VirtualEnv, I actually found I was running the x64 version of python when I'd installed the requests package into the python 32 bit folder c:\program files (x86)\python37-32\lib\site-packages. This is a screenshot from the internet but it shows you how to change the interpreter you're using - in my case - I need to set it to Python 3.7.4(x86) 32 bit:
Run in command prompt
and write command pip install requests in scripts directory
cd \Python27\scripts
pip install requests
That's the exact solution which works for me, please follow this:
As like, first try to get the version of the requests module installed previously, this can be find by
pip install requests
Now, you will get the message:
Requirement already satisfied: requests in /opt/anaconda3/lib/python3.8/site-packages (2.24.0)
See, here the version of the requests module i.e., (2.24.0)
Now, the simple basic logic is this like you should install just the previous version of the requests (2.24.0). So, you should now install requests (2.20.0)
For this use command:
pip install requests==2.20.0
Now, I think you can test import requests and this will work fine.
Further, if any error occurs then please let me know in the comments.
Thanks,
HaPpY Coding 🤗
This issue is due to missing request module in python package .So you can use below command to install and recheck by restarting your IDE
pip install requests
If already installed better to upgrade
pip install --upgrade pip
If you are using venv (virtual environment), you may need to consider where it's path. for my case it was outside my project folder. So I had to first install request inside the main python's path then I recreate venv inside my project.
inside_your_project#python -m venv ./venv

Resources