tmap icon indicating copy to clipboard operation
tmap copied to clipboard

Cannot import name Mapping from collections

Open hellorp1990 opened this issue 3 years ago • 4 comments

Hi,

I am having little difficulty in running "from tmap.tda import mapper, Filter" on python 3.10.

In Python 3.6 the code works perfectly fine.

I believe the problem is happening due to collections package as the Mapping is moved to collections.abc from collections. I changed that in my code.

Still the error is happening:

Importerror: cannot import name Mapping from collections (...../lib/python3.10/collections/init.py

Any idea how to fix it? Does Tmap run on python 3.10?

hellorp1990 avatar Jul 26 '22 11:07 hellorp1990

I apologise for the stalled tmap version. This problem is similar to issue #15

You can see that this error was generated by the "networkx" rather than the "tmap" if you read the traceback. Because the requirement file has fixed the version of networkx ==2.2 that would generate this error when you use other versions of Python.

The file $PYTHON/lib/python3.10/site-packages/networkx/classes/graph.py is where this problem originated. I would not change the requirement file at this time because different versions of networkx may produce different issues.

I will advise you to create a virtual environment using conda and install the python==3.8 instead of python==3.10.

If you encounter other issues, please let me know.

444thLiao avatar Jul 26 '22 14:07 444thLiao

Hi,

I have problem with using tmap. I installed tmap in a CentOS cluster. I used conda to install in a conda environment, where there are python==3.8 and networkx ==2.2. And I tried to install by pip in the same conditions. In both cases, tmap has no modules except 'name'.

For example, when I import fearun==0.4.1, I get this error

ModuleNotFoundError: No module named 'tmap.core' How can I solve this issue?

meddwl avatar Jul 30 '22 16:07 meddwl

@meddwl It sounds like it is a different issue and I believe it would be useful if you could give a screenshot or outputs from the installation. And I am not sure why you import fearun? Maybe you should check again what you have typed in.

I don't think we have core under the tmap library. Maybe you are talking about the other package also named tmap?

444thLiao avatar Jul 31 '22 09:07 444thLiao

Sorry, my mistake. I mixed up the packages because they have the same name. I apologize for the distraction. And thank you for the answer.

meddwl avatar Jul 31 '22 15:07 meddwl