ydataai / ydata-synthetic

Synthetic data generators for tabular and time-series data
https://docs.synthetic.ydata.ai
MIT License
1.41k stars 234 forks source link

[BUG] Unable to install version 1.0.0 with streamlit #245

Closed aiwithsap closed 1 year ago

aiwithsap commented 1 year ago

Describe the bug Unable to install version 1.0.0 with streamlit. Pip reports unresolvable conflict. Error message below:

ERROR: Cannot install ydata-synthetic and ydata-synthetic[streamlit]==1.0.0 because these package versions have conflicting dependencies.
The conflict is caused by:
    ydata-synthetic[streamlit] 1.0.0 depends on streamlit==0.18.1; extra == "streamlit"
    streamlit-pandas-profiling 0.1.3 depends on streamlit>=0.63

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

To Reproduce Issue the following command: pip install ydata-synthetic[streamlit]==1.0.0 Install fails with the above error message. If I install with "pip install ydata-synthetic==1.0.0 streamlit". The install succeeds but streamlit gives error on loading about CTGAN.

TypeError: 'type' object is not subscriptable
Traceback:
File "/usr/local/lib/python3.8/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/streamlit_app/pages/2_Generate_synthetic_data.py", line 3, in <module>
    from ydata_synthetic.streamlit_app.pages.functions.train import DataType
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/streamlit_app/pages/functions/train.py", line 7, in <module>
    from ydata_synthetic.synthesizers.regular import RegularSynthesizer
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/synthesizers/regular/__init__.py", line 1, in <module>
    from ydata_synthetic.synthesizers.regular.model import RegularSynthesizer
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/synthesizers/regular/model.py", line 17, in <module>
    from ydata_synthetic.synthesizers.regular.ctgan.model import CTGAN
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/synthesizers/regular/ctgan/__init__.py", line 1, in <module>
    from .model import CTGAN
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/synthesizers/regular/ctgan/model.py", line 18, in <module>
    class CTGAN(BaseModel):
File "/usr/local/lib/python3.8/dist-packages/ydata_synthetic/synthesizers/regular/ctgan/model.py", line 110, in CTGAN
    def fit(self, data: DataFrame, train_arguments: TrainParameters, num_cols: list[str], cat_cols: list[str]):

Expected behavior ydata-synthetic installs and streamlit works when invoked by the following code: from ydata_synthetic import streamlit_app streamlit_app.run()

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

fabclmnt commented 1 year ago

@aiwithsap Python 3.8 is no longer supported by the package.

The problem you're exposing seems not to be Streamlit version related. Can you please upgrade your python environment to 3.9 and let me know how it went?

fabclmnt commented 1 year ago

Related issue: https://github.com/ydataai/ydata-synthetic/issues/243

aiwithsap commented 1 year ago

Hi @fabclmnt,

Thanks for getting back to me. I used the following docker image to test with python 3.9. The dependency conflict error remains unchanged.

FROM continuumio/miniconda3:4.11.0
RUN pip install ydata-synthetic[streamlit]==1.0.0

Or

FROM ubuntu:jammy
RUN apt update --yes && apt-get install --yes software-properties-common
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN add-apt-repository ppa:deadsnakes/ppa 
RUN apt-get install --yes python3.9 python3-pip
RUN pip install ydata-synthetic[streamlit]==1.0.0

Same error:

ERROR: Cannot install ydata-synthetic and ydata-synthetic[streamlit]==1.0.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    ydata-synthetic[streamlit] 1.0.0 depends on streamlit==0.18.1; extra == "streamlit"
    streamlit-pandas-profiling 0.1.3 depends on streamlit>=0.63

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
aquemy commented 1 year ago

This is a different error than the one with type and it comes from the fact that you have the package streamlit-pandas-profiling installed and this package uses a much newer version of streamlit.

aquemy commented 1 year ago

In fact, this is due to this line: https://github.com/ydataai/ydata-synthetic/blob/dev/setup.py#L53

streamlit is directly installed by streamlit-pandas-profiling so I don't think it is necessary to install it or if we want, we should at least make sure the versions are not incompatible.

@fabclmnt we should probably do a minor release to have this fixed.

fabclmnt commented 1 year ago

Oh ok I see it! I missed that completely @aiwithsap! Indeed. We will need a quick release to fix that!

Thank you @aquemy!

aquemy commented 1 year ago

@aiwithsap we released a minor version with the dependency fixes. Please, to try install 1.0.1.

aiwithsap commented 1 year ago

Thanks for helping. Everything is working well.