pip install error - ImportError: No module named finsymbols - python

When I run:
sudo -H pip install finsymbols
I get the below response:
Requirement already satisfied: finsymbols in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: beautifulsoup4>=4.2.1 in /usr/local/lib/python2.7/dist-packages (from finsymbols)
then when I run
$ python
>>> from finsymbols import symbols
I get
File "", line 1, in
ImportError: No module named finsymbols
My question is, why am I getting the error when the module is installed?

You may have multiple versions of Python.
Requirement already satisfied: finsymbols in /usr/local/lib/python2.7/dist-packages Requirement already satisfied: beautifulsoup4>=4.2.1 in /usr/local/lib/python2.7/dist-packages (from finsymbols)
Pip has installed it in python2.7 path. Your default Python may be different.
So try using
$ python2.7
instead of
$ python

If you want to install a module that runs on Python 3.x, you need to use
pip3 install module_name
Or link the pip3 executable in /usr/bin to replace pip. In this way, you can use pip to install Python 3.x modules.
Here I strongly recommend to use virtualenv to manage your Python module environments. More details can be found here.

Thanks jonatan, that worked.
I ran
pip install finsymbols
not
sudo -H pip install finsymbols
and that fixed the issue

Related

python -m pip <package> ERROR: unknown command <package>

I'm trying to run a package I installed with pip from command line. (this one, not that it matters)
I try to run a package with either:
python -m pip yawsso
ERROR: unknown command "yawsso"
or just calling it in the command line:
> yawsso
zsh: command not found: yawsso
I then check to see if it's installed properly, and it is
> pip list
Package Version
---------------- -------
pip 21.2.4
(...)
yawsso 0.7.1
> pip install yawsso
Requirement already satisfied: yawsso in /Users/<user>/Library/Python/3.9/lib/python/site-packages (0.7.1)
What's going on?
EDIT: As I mentioned. I have already tried installing it and it says the requirement is met:
> python -m pip install yawsso
Requirement already satisfied: yawsso in /Users/federico.esteban/Library/Python/3.9/lib/python/site-packages (0.7.1)
For Modern macos/OSX, you need to find your ~/Library/Python/$version/bin directory and add it to your $PATH.
I added this line to my .zshrc
export PATH=$HOME/Library/Python/3.9/bin:$PATH
After this my yawsso is working correctly.
Dont leave out install , the correct command is python -m pip install yawsso

Issue with impacket & python

Hi there boys and girls,
I am trying to run a script written in python and the console is telling me this:
Install the following library to make this script work
Impacket : https://github.com/CoreSecurity/impacket.git
PyCrypto : https://pypi.python.org/pypi/pycrypto
The problem is that I have already installed those python packages in python3 so when I make a request via pip for those packages I receive this:
Requirement already satisfied: impacket in /usr/local/lib/python3.8/dist-packages (0.9.17)
Requirement already satisfied: ldap3>=2.5.0 in /usr/lib/python3/dist-packages (from impacket) (2.7)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from impacket) (1.15.0)
Hid the rest of the lines but the idea is that. I understand that the package is already installed in my system but I cannot use those with python2.7.
Any idea how to solve this?
In this case the error is because you have not installed impacket for python2.7.
Before installing impacket we need to install pip2 in python2.7, Download get-pip.py form Link
if pip2 is already installed you can verify this by
pip --verison, output of that command should be
pip 20.3.3 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
If pip2 is not installed then install pip2 in python2 package using sudo python2 get-pip.py
Next, install impacket for python2 using pip install . (this must be with in the impacket directory link)
then try to run your script

Python no module named 'requests' even install requests

I run my python scrapy project shows the error no module named 'requests'
So I type pip install requests
and then terminal information:
Requirement already satisfied: requests in ./Library/Python/2.7/lib/python/site-packages (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./Library/Python/2.7/lib/python/site-packages (from requests) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./Library/Python/2.7/lib/python/site-packages (from requests) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./Library/Python/2.7/lib/python/site-packages (from requests) (1.25.7)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/2.7/lib/python/site-packages (from requests) (2019.11.28)
type command pip list can see request 2.22.0
I type command python --version to check the python version:
python 2.7.16
Finally I run my scrapy project again still see the same error no module named 'requests'
I have no idea how to fix the error now, any help would be appreciated. Thanks.
Install python3 and pip3 and then pip3 install requests
if you are on ubuntu python3 is installed by default
you should first install pip3 by apt install python3-pip and then pip3 install requests
If you are using two different versions of Python, it should explain why you can't use your module.
To install the module on Python 3, try:
pip3 install requests
And make sure, you are using the correct version.
Check if you are using the same interpreter to which you have installed the package using pip install. As a best practice to avoid this type of issues when you have multiple versions of python, use pip as a module instead of directly calling pip.
eg:
python -m pip install requests
python3 -m pip install requests

Python import fails Openpyxl

I know many questions speak about this problem, but i tried a lot and didn't fin any solution to my "very classical" issue : Python import fails altough package installed:
MacBook-Pro-de-Stephanie:scripts user$ sudo -H pip install openpyxl
Collecting openpyxl
Requirement already satisfied (use --upgrade to upgrade): jdcal in /usr/local/lib/python2.7/site-packages (from openpyxl)
Requirement already satisfied (use --upgrade to upgrade): et-xmlfile in /usr/local/lib/python2.7/site-packages (from openpyxl)
Installing collected packages: openpyxl
Successfully installed openpyxl-2.3.5
Package installed right ?
MacBook-Pro-de-Stephanie:scripts user$ python interactionsXLSX2CSV.py
Traceback (most recent call last):
File "interactionsXLSX2CSV.py", line 5, in <module>
from openpyxl import load_workbook
ImportError: No module named openpyxl
Fails right ?
MacBook-Pro-de-Stephanie:scripts user$ echo $PYTHONPATH
/usr/local/lib/python2.7/:
Path seems ok, no ?
I set permissions with:
sudo chmod -R ugo+rX ./lib/python2.7/site-packages/
What can i try else ?
Thank you very much
Here was the solution for me (linked to Mac OS clearly) : Can't load Python modules installed via pip from site-packages directory
/usr/bin/python is the executable for the python that comes with OS
X. /usr/local/lib is a location for user-installed programs only,
possibly from Python.org or Homebrew. So you're mixing different
Python installs, and changing the python path is only a partial
workaround for different packages being installed for different
installations.
In order to make sure you use the pip associated with a particular
python, you can run python -m pip install <pkg>, or go look at what
the pip on your path is, or is symlinked to.
I am not getting that error. Just now i installed. All i am getting is
" /usr/local/lib/python2.7/dist-packages/openpyxl/xml/init.py:15: UserWarning: The installed version of lxml is too old to be used with openpyxl
warnings.warn("The installed version of lxml is too old to be used with openpyxl")"
Once try by using below command.
sudo apt-get install python-openpyxl

installing flask in Python on Heroku

I'm trying to follow this guide.
I made virtualenv and installed flask in it:
Requirement already satisfied (use --upgrade to upgrade): Flask in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from Flask)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from Flask)
After pip freeze > requirements.txt the file contains only:
argparse==1.2.1
distribute==0.6.28
wsgiref==0.1.2
And there is no Flask package. I'm trying to run simple example and got:
ImportError: No module named flask
How to install the package properly?
You need to run pip freeze > reuirements.txt inside your virtualenv. Thus, make sure that your virtualenv was activated correctly. As the Heroku documentation is mostly written from Linux point of view, this may be a little tricky especially on Windows (see a related question):
Windows command-prompt activation is done using venv\Scripts\activate.bat
If you are using Windows PowerShell, you need to run venv\Scripts\activate.ps1 instead.
Note that you need to activate virtualenv for sudo as well. Example:
sudo bash
source venv/bin/activate
pip install Flask
However one of the points in virtualenv is that you don't need sudo. Thus, you could simply omit using sudo and simply just run:
source venv/bin/activate
pip install Flask

Categories