0

I have install ipyvolume, but when I tried it to import with virtual environment it I get message of

>>> import ipyvolume
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\mustafa\tutortial_env\lib\site-packages\ipyvolume\__init__.py", line 4, in <module>
    from . import styles
  File "C:\mustafa\tutortial_env\lib\site-packages\ipyvolume\styles.py", line 56, in <module>
    utils.dict_deep_update(default, _defaults)
  File "C:\mustafa\tutortial_env\lib\site-packages\ipyvolume\utils.py", line 19, in dict_deep_update
    if isinstance(v, collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'

Can anyone help please?

Mmm
  • 3
  • 3

1 Answers1

0

I had the same issue when using a virtual environment. In my case, it seems that when installing the ipyvolume library with pip, it installs a version that was developped for python 3.9 and not >=3.10. Some issue then appears with the collection library which should be collection.abc.

This post actually solved the problem for me, as I modified the ipyvolume/utils.py script (in your case "C:\mustafa\tutortial_env\lib\site-packages\ipyvolume\utils.py") like this:

from __future__ import print_function
from collections.abc import Mapping   # Only for Mapping
import collections  # This line used to be the last of the imports, used when calling defaultdic, not available in collections.abc
import requests
import io
import os
import numpy as np
import functools
import time


...

  if isinstance(v, Mapping):
      r = dict_deep_update(d.get(k, {}), v)

Note that when installing ipyvolume 0.5.2 with pip, collections is imported twice in this file.

Roman
  • 16
  • 1