Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannort import benedict #44

Closed
gschoenberger opened this issue Dec 7, 2020 · 14 comments
Closed

Cannort import benedict #44

gschoenberger opened this issue Dec 7, 2020 · 14 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@gschoenberger
Copy link

Python version
3.8

Package version
0.22.2

Current behavior (bug description)

from benedict import benedict
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'benedict' from 'benedict' (unknown location)

Expected behavior
It should be possible to import and use benedict.

** Additional pip information
$ pip show python-benedict
Name: python-benedict
Version: 0.22.2
Summary: python-benedict is a dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities... for humans, obviously.
Home-page: https://github.com/fabiocaccamo/python-benedict
Author: Fabio Caccamo
Author-email: fabio.caccamo@gmail.com
License: MIT

@gschoenberger gschoenberger added the bug Something isn't working label Dec 7, 2020
@fabiocaccamo
Copy link
Owner

This is really strange, you are the first one reporting this issue.
Could you send please a PR containing a test which should succeed but fails?

@gschoenberger
Copy link
Author

I found the problem!
PyCharm installed the wrong benedict: https://pypi.org/project/BeneDict/
PyCharm installed "BeneDict" with "pip install benedict" automatically when using the import statement: "from benedict import benedict"
But as you wrote in the docs, you have to run "pip install python-benedict"...

@fabiocaccamo
Copy link
Owner

I understand... maybe it would be useful to report this issue to PyCharm.

@fabiocaccamo fabiocaccamo added invalid This doesn't seem right and removed bug Something isn't working labels Dec 7, 2020
@Vermyndax
Copy link

Interestingly, I'm having this exact same problem. I verified that I installed python-benedict, unlike the person above, but it's still not finding the library.

@fabiocaccamo
Copy link
Owner

@Vermyndax are you using PyCharm too?

@Vermyndax
Copy link

No, I'm using just regular old pip. Even more odd... if I run this from a virtualenv, Benedict isn't recognized. If I come out of the venv and use system packages, it works fine. Both were installed with pip.

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Sep 29, 2021

@Vermyndax also I use pip with virtualenv, have you installed the right package and are you importing it correctly?

  • pip install python-benedict
  • from benedict import benedict

@Vermyndax
Copy link

The best I can tell, I did those just fine. If I activate the virtual environment and execute those commands, it will not import properly.

If I run it from the system, it will work fine.

Here's the .venv listing from pip:

`
Package Version Location


attrs 21.2.0
autopep8 1.5.7
aws-cdk.assets 1.124.0
aws-cdk.aws-apigateway 1.124.0
aws-cdk.aws-applicationautoscaling 1.124.0
aws-cdk.aws-autoscaling 1.124.0
aws-cdk.aws-autoscaling-common 1.124.0
aws-cdk.aws-autoscaling-hooktargets 1.124.0
aws-cdk.aws-backup 1.124.0
aws-cdk.aws-certificatemanager 1.124.0
aws-cdk.aws-cloudformation 1.124.0
aws-cdk.aws-cloudfront 1.124.0
aws-cdk.aws-cloudwatch 1.124.0
aws-cdk.aws-codebuild 1.124.0
aws-cdk.aws-codecommit 1.124.0
aws-cdk.aws-codeguruprofiler 1.124.0
aws-cdk.aws-codepipeline 1.124.0
aws-cdk.aws-codestarnotifications 1.124.0
aws-cdk.aws-cognito 1.124.0
aws-cdk.aws-dynamodb 1.124.0
aws-cdk.aws-ec2 1.124.0
aws-cdk.aws-ecr 1.124.0
aws-cdk.aws-ecr-assets 1.124.0
aws-cdk.aws-ecs 1.124.0
aws-cdk.aws-efs 1.124.0
aws-cdk.aws-elasticloadbalancing 1.124.0
aws-cdk.aws-elasticloadbalancingv2 1.124.0
aws-cdk.aws-elasticloadbalancingv2-targets 1.124.0
aws-cdk.aws-events 1.124.0
aws-cdk.aws-events-targets 1.124.0
aws-cdk.aws-globalaccelerator 1.124.0
aws-cdk.aws-iam 1.124.0
aws-cdk.aws-kinesis 1.124.0
aws-cdk.aws-kinesisfirehose 1.124.0
aws-cdk.aws-kms 1.124.0
aws-cdk.aws-lambda 1.124.0
aws-cdk.aws-logs 1.124.0
aws-cdk.aws-logs-destinations 1.124.0
aws-cdk.aws-rds 1.124.0
aws-cdk.aws-route53 1.124.0
aws-cdk.aws-route53-targets 1.124.0
aws-cdk.aws-s3 1.124.0
aws-cdk.aws-s3-assets 1.124.0
aws-cdk.aws-sam 1.124.0
aws-cdk.aws-secretsmanager 1.124.0
aws-cdk.aws-servicediscovery 1.124.0
aws-cdk.aws-signer 1.124.0
aws-cdk.aws-sns 1.124.0
aws-cdk.aws-sns-subscriptions 1.124.0
aws-cdk.aws-sqs 1.124.0
aws-cdk.aws-ssm 1.124.0
aws-cdk.aws-stepfunctions 1.124.0
aws-cdk.cloud-assembly-schema 1.124.0
aws-cdk.core 1.124.0
aws-cdk.custom-resources 1.124.0
aws-cdk.cx-api 1.124.0
aws-cdk.region-info 1.124.0
cattrs 1.8.0
certifi 2021.5.30
charset-normalizer 2.0.6
constructs 3.3.155
flake8 3.9.2
ftfy 6.0.3
idna 3.2
iniconfig 1.1.1
jsii 1.34.0
mailchecker 4.0.12
mccabe 0.6.1
packaging 21.0
phonenumbers 8.12.33
pip 21.2.4
pluggy 1.0.0
publication 0.0.3
py 1.10.0
pycodestyle 2.7.0
pyflakes 2.3.1
pyparsing 2.4.7
pytest 6.2.5
python-benedict 0.24.2
python-dateutil 2.8.2
python-fsutil 0.5.0
python-slugify 5.0.2
PyYAML 5.4.1
requests 2.26.0
setuptools 57.4.0
six 1.16.0
text-unidecode 1.3
toml 0.10.2
typing-extensions 3.10.0.2
urllib3 1.26.7
wcwidth 0.2.5
wheel 0.37.0
xmltodict 0.12.0
`

Here's the listing from the system outside the virtual env:

`
Package Version Location


attrs 21.2.0
autopep8 1.5.7
aws-cdk.assets 1.124.0
aws-cdk.aws-apigateway 1.124.0
aws-cdk.aws-applicationautoscaling 1.124.0
aws-cdk.aws-autoscaling 1.124.0
aws-cdk.aws-autoscaling-common 1.124.0
aws-cdk.aws-autoscaling-hooktargets 1.124.0
aws-cdk.aws-backup 1.124.0
aws-cdk.aws-certificatemanager 1.124.0
aws-cdk.aws-cloudformation 1.124.0
aws-cdk.aws-cloudfront 1.124.0
aws-cdk.aws-cloudwatch 1.124.0
aws-cdk.aws-codebuild 1.124.0
aws-cdk.aws-codecommit 1.124.0
aws-cdk.aws-codeguruprofiler 1.124.0
aws-cdk.aws-codepipeline 1.124.0
aws-cdk.aws-codestarnotifications 1.124.0
aws-cdk.aws-cognito 1.124.0
aws-cdk.aws-dynamodb 1.124.0
aws-cdk.aws-ec2 1.124.0
aws-cdk.aws-ecr 1.124.0
aws-cdk.aws-ecr-assets 1.124.0
aws-cdk.aws-ecs 1.124.0
aws-cdk.aws-efs 1.124.0
aws-cdk.aws-elasticloadbalancing 1.124.0
aws-cdk.aws-elasticloadbalancingv2 1.124.0
aws-cdk.aws-elasticloadbalancingv2-targets 1.124.0
aws-cdk.aws-events 1.124.0
aws-cdk.aws-events-targets 1.124.0
aws-cdk.aws-globalaccelerator 1.124.0
aws-cdk.aws-iam 1.124.0
aws-cdk.aws-kinesis 1.124.0
aws-cdk.aws-kinesisfirehose 1.124.0
aws-cdk.aws-kms 1.124.0
aws-cdk.aws-lambda 1.124.0
aws-cdk.aws-logs 1.124.0
aws-cdk.aws-logs-destinations 1.124.0
aws-cdk.aws-rds 1.124.0
aws-cdk.aws-route53 1.124.0
aws-cdk.aws-route53-targets 1.124.0
aws-cdk.aws-s3 1.124.0
aws-cdk.aws-s3-assets 1.124.0
aws-cdk.aws-sam 1.124.0
aws-cdk.aws-secretsmanager 1.124.0
aws-cdk.aws-servicediscovery 1.124.0
aws-cdk.aws-signer 1.124.0
aws-cdk.aws-sns 1.124.0
aws-cdk.aws-sns-subscriptions 1.124.0
aws-cdk.aws-sqs 1.124.0
aws-cdk.aws-ssm 1.124.0
aws-cdk.aws-stepfunctions 1.124.0
aws-cdk.cloud-assembly-schema 1.124.0
aws-cdk.core 1.124.0
aws-cdk.custom-resources 1.124.0
aws-cdk.cx-api 1.124.0
aws-cdk.region-info 1.124.0
cattrs 1.8.0
certifi 2021.5.30
charset-normalizer 2.0.6
constructs 3.3.155
flake8 3.9.2
ftfy 6.0.3
idna 3.2
iniconfig 1.1.1
jsii 1.34.0
mailchecker 4.0.12
mccabe 0.6.1
packaging 21.0
phonenumbers 8.12.33
pip 21.2.4
pluggy 1.0.0
publication 0.0.3
py 1.10.0
pycodestyle 2.7.0
pyflakes 2.3.1
pyparsing 2.4.7
pytest 6.2.5
python-benedict 0.24.2
python-dateutil 2.8.2
python-fsutil 0.5.0
python-slugify 5.0.2
PyYAML 5.4.1
requests 2.26.0
setuptools 57.4.0
six 1.16.0
text-unidecode 1.3
toml 0.10.2
typing-extensions 3.10.0.2
urllib3 1.26.7
wcwidth 0.2.5
wheel 0.37.0
xmltodict 0.12.0
`

@fabiocaccamo
Copy link
Owner

@Vermyndax :(
could you please try to follow these steps locally and tell me if everything works fine or not?

@Vermyndax
Copy link

@fabiocaccamo don't stress too much, I am likely to blame for something falling down here!

Followed the steps and it appeared that everything worked fine. ¯_(ツ)_/¯

@ddl-tanner-green
Copy link

pip uninstall python-benedict
pip uninstall benedict
pip install python-benedict

@stanleyjs
Copy link

Having this problem in 2023. I tried doing what @ddl-tanner-green suggested and this did not fix the broken install

@fabiocaccamo
Copy link
Owner

What happens if you follow these steps?

https://github.com/fabiocaccamo/python-benedict#testing

@shalomb
Copy link

shalomb commented Sep 22, 2023

what worked for me was to downgrade and upgrade back to same version? hmm

$ python3 -c 'from benedict import benedict^J'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name 'benedict' from 'benedict' (unknown location)

$ pip list | grep -i benedict
python-benedict    0.32.1

$ pip install python-benedict==0.30

$ python3 -c 'from benedict import benedict^J'

$ pip install -U python-benedict

$ python3 -c 'from benedict import benedict^J'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

6 participants