humps icon indicating copy to clipboard operation
humps copied to clipboard

An import issue after install and remove the 'humps' package.

Open flavono123 opened this issue 2 years ago • 3 comments

Describe the bug After installation and removing the 'humps' package, the humps module is seemed not loaded.

To Reproduce Steps to reproduce the behavior:

❯ python --version
Python 3.8.8

❯ pip install humps
(...eliding...)
# I've noticed this is not what I want 
# So remove it 
❯ pip uninstall humps

# Install the correct package
❯ pip install pyhumps
❯ pip list | grep humps
pyhumps          3.7.1

❯ python
Python 3.8.8 (default, Nov 23 2021, 14:07:49)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import humps
>>> humps.decamelize('illWearYourGranddadsClothes')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'humps' has no attribute 'decamelize'
>>> import inspect
>>> inspect.getfile(humps)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/hansuk/.pyenv/versions/3.8.8/lib/python3.8/inspect.py", line 659, in getfile
    raise TypeError('{!r} is a built-in module'.format(object))
TypeError: <module 'humps' (namespace)> is a built-in module

Expected behavior import humps should work.

Desktop (please complete the following information):

  • OS: macOS
  • Version 11.6.1
❯ sw_vers
ProductName:    macOS
ProductVersion: 11.6.1
BuildVersion:   20G224

flavono123 avatar May 23 '22 02:05 flavono123

I have tried the same sequence of commands, albeit with 3.8.0, but it works alright.

Maybe there is an issue with your venv/python path?

Details
$ python --version
Python 3.8.0
$ python
Python 3.8.0 (default, Aug 18 2021, 21:21:55) 
# ....
$ pip install humps
Collecting humps
  Downloading humps-0.2.2-py2.py3-none-any.whl (5.3 kB)
Installing collected packages: humps
Successfully installed humps-0.2.2
$ pip uninstall humps
Found existing installation: humps 0.2.2
Uninstalling humps-0.2.2:
# ...
  Successfully uninstalled humps-0.2.2
$ pip install pyhumps
Collecting pyhumps
  Using cached pyhumps-3.7.1-py3-none-any.whl (5.5 kB)
Installing collected packages: pyhumps
Successfully installed pyhumps-3.7.1
$ pip show pyhumps
Name: pyhumps
Version: 3.7.1
# ...
$ python
Python 3.8.0 (default, Aug 18 2021, 21:21:55) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import humps
>>> humps.camelize("hello_world")
'helloWorld'
>>> 

aphilas avatar May 29 '22 11:05 aphilas

@flavono123 I couldn't replicate the issue exactly however I managed to get similar results by just installing the humps module instead of pyhumps. The issue seems to be with your environment. Make sure pip points to the same python version as your python command, i.e. both commands pip -V and python -V mentions the same python version. (in this case python 3.8)

ificiana avatar May 29 '22 17:05 ificiana

#246 solves the naming issue.

fabaff avatar Jul 03 '22 09:07 fabaff