higlass-python icon indicating copy to clipboard operation
higlass-python copied to clipboard

installation--> import error

Open gfudenberg opened this issue 2 years ago • 6 comments
trafficstars

just tried pip installing into the open2c environment and am getting the following:

import higlass as hg
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In [5], line 1
----> 1 import higlass as hg

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass/__init__.py:8
      5 except PackageNotFoundError:
      6     __version__ = "uninstalled"
----> 8 from higlass_schema import *
     10 import higlass.tilesets
     11 from higlass.api import *

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass_schema/__init__.py:6
      3 except ImportError:
      4     __version__ = "unknown"
----> 6 from .schema import *

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass_schema/schema.py:19
     17 from pydantic import BaseModel as PydanticBaseModel
     18 from pydantic import Extra, Field
---> 19 from pydantic.class_validators import root_validator
     20 from pydantic.generics import GenericModel as PydanticGenericModel
     21 from typing_extensions import Literal, TypedDict, Annotated

ModuleNotFoundError: No module named 'pydantic.class_validators'

Version info for higlass/pydantic:

conda list |grep higlass
higlass-python            1.0.0rc1                 pypi_0    pypi
higlass-schema            0.0.4                    pypi_0    pypi
higlass-widget            0.0.7                    pypi_0    pypi
conda list |grep pyd
pydantic                  2.0a1                    pypi_0    pypi
pydantic-core             0.22.0                   pypi_0    pypi

gfudenberg avatar Apr 05 '23 00:04 gfudenberg

pinned pydantic to 1.0

pydantic.version.VERSION
StrictVersion ('1.0')

However

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In [3], line 1
----> 1 import higlass as hg

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass/__init__.py:8
      5 except PackageNotFoundError:
      6     __version__ = "uninstalled"
----> 8 from higlass_schema import *
     10 import higlass.tilesets
     11 from higlass.api import *

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass_schema/__init__.py:6
      3 except ImportError:
      4     __version__ = "unknown"
----> 6 from .schema import *

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass_schema/schema.py:23
     20 from pydantic.generics import GenericModel as PydanticGenericModel
     21 from typing_extensions import Literal, TypedDict, Annotated
---> 23 from .utils import exclude_properties_titles, get_schema_of, simplify_enum_schema
     24 import functools
     27 # Override Basemodel

File ~/.conda/envs/open2c/lib/python3.8/site-packages/higlass_schema/utils.py:3
      1 from typing import Any, Dict, TypeVar
----> 3 from pydantic import BaseModel, schema_of
      6 def simplify_schema(root_schema: Dict[str, Any]) -> Dict[str, Any]:
      7     """Lift defintion reference to root if only definition"""

ImportError: cannot import name 'schema_of' from 'pydantic' (/home1/fudenber/.conda/envs/open2c/lib/python3.8/site-packages/pydantic/__init__.py)

gfudenberg avatar Apr 06 '23 20:04 gfudenberg

I went past the pydantic issues by using its last stable version v1.10.7 I guess it installs pydantic 2 because of the --pre flag in pip install

The higlass-python doesn't work for me still though... There are no more errors, but it doesn't render even remote heatmaps

sergpolly avatar Apr 06 '23 20:04 sergpolly

The higlass-python doesn't work for me still though... There are no more errors, but it doesn't render even remote heatmaps

Yes, there seems to be an issue with the default HTML repr. I'll resolve this asap, but have limited time at the moment. As a workaround, you should be able to use the .widget() method to render the visualization as Jupyter Widget (instead of the default behavior).

import higlass as hg

# Remote data source (tileset)
tileset1 = hg.remote(
    uid="CQMd6V_cRw6iCI_-Unl3PQ",
    server="https://higlass.io/api/v1/",
    name="Rao et al. (2014) GM12878 MboI (allreps) 1kb",
)

# Local tileset
tileset2 = hg.cooler("../data/dataset.mcool")

# Create a `hg.HeatmapTrack` for each tileset
track1 = tileset1.track("heatmap")
track2 = tileset2.track("heatmap")

# Create two independent `hg.View`s, one for each heatmap
view1 = hg.view(track1, width=6)
view2 = hg.view(track2, width=6)

# Lock zoom & location for each `View`
view_lock = hg.lock(view1, view2)

# Concatenate views horizontally and apply synchronization lock
(view1 | view2).locks(view_lock).widget()

or

view1.widget()

manzt avatar Apr 07 '23 01:04 manzt

.widget() works indeed ! Thank you !

sergpolly avatar Apr 07 '23 21:04 sergpolly

Published a new release candidate which should fix the rendering issue (without .widget()). I think the biggest priority right now is trying to resolve cooler compatibility clodius (especially if you're using cooltools).

manzt avatar Apr 20 '23 02:04 manzt

yez ! I've actually just tried to see if I can help with that https://github.com/higlass/clodius/issues/150 ...

Since that issue, I've managed to run clodius tests and see tiles/coolper.py failures - that's a start ...

Unfortunately I don't know much about tiles-serving logic inside, so if you know what needs to be fixed even more specifically - that would help !

sergpolly avatar Apr 20 '23 02:04 sergpolly