Python cannot import name 'find_namespace_packages' from 'setuptools' package - python

I'm currently creating a python library and need to use the 'find_namespace_packages' from the 'setuptools' package. However python throwing out the following ImportError message whenever it runs:
ImportError: cannot import name 'find_namespace_packages' from 'setuptools'
However it has no trouble importing the other functions from 'setuptools' like 'setup' and 'find_packages'.
How do I troubleshoot it?
I have uninstalled and reinstalled 'setuptools' multiple times already and updated Spyder and Anaconda.
Also here is a sample of my code:
from setuptools import setup, find_namespace_packages
setup(
name="sample",
version="0.0.1",
packages=find_namespace_packages()
)
I am currently using Python 3.7.5 and setuptools is on version 49.6.0

As mentioned in the question's comments, the solution is to run
pip install -U setuptools
And afterwards retry installing all the packages, e.g.
pip install -e .

Related

No module named 'bcolors' although 'Requirement already satisfied'

I am trying to use bcolors in my python code in Spyder/Anaconda but it keeps telling me
ModuleNotFoundError: No module named 'bcolors'.
So I installed it with pip install bcolorswhich gave me Requirement already satisfied: bcolors in e:\anaconda3\lib\site-packages (1.0.4), but it still doesn't work.
What am I doing wrong?
You had that error because you are in different interpreter trying to import the module. You should append the path of the module to your working directory.
import sys
sys.path.append("\anaconda3\lib\site-packages")
import bcolors
Try to install lower version of this module
pip install bcolors==1.0.2
Have you tried installing the pandas' library using pip install pandas
I was having trouble with the latest distribution as well. Installing 1.0.2 worked for me.

Why do I get 'No module named 'currency-symbols' when importing xls2xlsx, even though 'pip install currency-symbols' returns requirement satisfied?

My IDE is Spyder and the distribution I am using is miniconda. I use pip install in the anaconda prompt window (as I usually do).
'pip install xls2xlsx' seems to run fine and install the package.
When I try 'from xls2xlsx import XLS2XLSX' I get the following error:
ModuleNotFoundError: No module named 'currency-symbols'
If I try 'pip install currency-symbols' , I get:
'Requirement already satisfied: currency-symbols in c:\users\user\miniconda3\lib\site-packages (2.0.2) '
I can see both directories in the site-packages directory.
So I had the same or very similar problem, my trace-back said it could not import currency_symbols. I found that the module it was trying to import was the constants from that package. So I went into the py file where xls2xlsx had the issue
"htmlxls2xlsx.py" my traceback said line 40..
currency_symbols_constants =
importlib.import_module('currency-symbols.constants')
I noticed this was part of an 'exception' so I fixed line 37 from import currency_symbols.constants as currency_symbols_constants to import currency_symbols._constants as currency_symbols_constants
Now it imports just fine.
I also had version 2.0.2 of currency-symbols installed, but my working host was using 2.0.1. I discovered that if you install 2.0.1, the issue did not occur.
pip3 install -Iv currency-symbols==2.0.1

No module named 'bankdate'(How to import just .py??)

Sorry that I have no idea how to describe this situation. The bigger package I like to install is "finance" (http://pydoc.net/finance/0.2502/finance.bankdate/). I downloaded it and unzipped to install using python setup.py install.
However, I cannot resolve importing another sub-module
bankdate(.py)
When I use finance module, there comes the error message, "ImportError: No module named 'bankdate'.(It is required in "__init__.py" under finance.) bankdate.py seems to be file under finance folder. How could I install "bankdate"?? Does anybody help me with this??
Thank you~!
cf) pip install bankdate, easy_install bankdate don't work in this case.
I do not know if you are working with Linux or Windows. But it would be a good start checking if the package was installed properly. You could use the following code to check installed packages and its versions:
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
By doing so packages installed using both setuptools and pip will appear in a list below. If your package does not appear in the list there you have, it was not installed.
Neverhteless try to import the module usign this:
from finance import bankdate
And see if the error continue. Hope it helps.
you can use pip install finance or you can download .whl file use pip intsall .whl
you can try

Python: ImportError: No module named _pluggy

I am getting ImportError: No module named _pluggy error when running tests using pytest.
Then I tried installing pluggy using pip install pluggy. It installs pluggy==0.6.0 successfully, but is still giving the error.
Versions List (From running pip freeze | grep pytest)
pytest==3.3.1
pytest-cov==2.5.1
pytest-metadata==1.5.0
pytest-runner==3.0
pluggy==0.6.0
Python 2.7.12
Shown below is the stack trace
Tests run successfully when run in a virtualenv. What are the possible causes which can cause this error in a non-virtualenv environment?
As it was pointed out by #bouteillebleu the issue was in pytest-metadata package.
The solution was to upgrade the package
pip install --upgrade pytest-metadata

Setup.py attempts to import the package it is installing

UPDATE
This is a bug in the setup.py of the package
Attempting to install certain packages using pip and I get this error:
pip install saspy
command python setup.py egg_info failed with error code 1
Upon reading the traceback I see that it failed while attempting to import saspy.This is an excerpt from the setup.py which is indeed attempting to import from saspy, while installing saspy. How is this supposed to work? I am using setuptools 36.0.1, pip 9.0.1 and (long story) python 2.7.8.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from saspy import __version__
with open('README.md') as f:
readme = f.read()
This is a buggy setup.py. It's a common mistake, since with a source installation, you can import the package from the unpacked source tree before it's been installed.
saspy requires Python3. I would expect this issue is due to using Python2 to try to install it. Though I have never seen that error before when installing it.

Categories

Resources