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

[BUG] **AttributeError: module 'fiftyone' has no attribute 'config'** #1718

Closed
syedrz opened this issue May 2, 2022 · 3 comments
Closed
Labels
bug Bug fixes

Comments

@syedrz
Copy link

syedrz commented May 2, 2022

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset(
  "coco-2017", 
  split="validation",
  label_types=["detections", "segmentations"],
  max_samples=5,
)
session = fo.launch_app(dataset)

I am running above code in notebook when I get following error


AttributeError Traceback (most recent call last)
/tmp/ipykernel_15399/2460818995.py in
----> 1 import fiftyone as fo
2 import fiftyone.zoo as foz
3
4 dataset = foz.load_zoo_dataset(
5 "coco-2017",

~/conda/lib/python3.8/site-packages/fiftyone/init.py in
30
31 if _os.environ.get("FIFTYONE_DISABLE_SERVICES", "0") != "1":
---> 32 _foo.delete_non_persistent_datasets_if_allowed()
33 _fom.migrate_database_if_necessary()
34 _fou.log_import_if_allowed()

~/conda/lib/python3.8/site-packages/fiftyone/core/odm/database.py in delete_non_persistent_datasets_if_allowed()
239
240 if num_connections <= 1:
--> 241 fod.delete_non_persistent_datasets()
242
243

~/conda/lib/python3.8/site-packages/fiftyone/core/dataset.py in delete_non_persistent_datasets(verbose)
180 verbose (False): whether to log the names of deleted datasets
181 """
--> 182 for name in _list_datasets(include_private=True):
183 try:
184 dataset = Dataset(name, _create=False, _virtual=True)

~/conda/lib/python3.8/site-packages/fiftyone/core/dataset.py in _list_datasets(include_private)
4584
4585 def _list_datasets(include_private=False):
-> 4586 conn = foo.get_db_conn()
4587
4588 if include_private:

~/conda/lib/python3.8/site-packages/fiftyone/core/odm/database.py in get_db_conn()
347 """
348 _connect()
--> 349 db = _client[fo.config.database_name]
350 return _apply_options(db)
351

AttributeError: module 'fiftyone' has no attribute 'config'

@syedrz syedrz added the bug Bug fixes label May 2, 2022
@syedrz
Copy link
Author

syedrz commented May 2, 2022

Little background,
I ran this on both colab and local notebook and faced same issues as mentioned below

When I try to import fiftyone
import fiftyone as fo

I got following error
ImportError: cannot import name '_registerMatType' from 'cv2.cv2' (/usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-x86_64-linux-gnu.so)

then I resolved it using
!pip uninstall opencv-python -y
!pip install opencv-python
!pip uninstall opencv-python-headless -y
!pip install opencv-python-headless==4.1.2.30

After this when I try to import fiftyone I get error
AttributeError: module 'fiftyone' has no attribute 'config'

@brimoor
Copy link
Contributor

brimoor commented May 2, 2022

The cv2 _registerMatType error can be resolved by following these instructions (which I see that you did in your follow-up message).

Note that you need to restart the notebook's runtime after reinstalling packages <-- I think this will resolve your issue.

@syedrz
Copy link
Author

syedrz commented May 4, 2022

Thanks for the instructions, Issue is resolved

@brimoor brimoor closed this as completed May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes
Projects
None yet
Development

No branches or pull requests

2 participants