JasonKessler / scattertext

Beautiful visualizations of how language differs among document types.
Apache License 2.0
2.23k stars 287 forks source link

Import failure #135

Closed jjgecon closed 3 weeks ago

jjgecon commented 3 weeks ago

Descrioption

I tried to import the package and get an error

import scattertext as st

and get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[50], line 2
      1 # Let's use the scatter text thingy
----> 2 import scattertext as st

File ~/miniforge3/envs/econ_geo/lib/python3.11/site-packages/scattertext/__init__.py:165
    163 from scattertext.TermDocMatrixWithoutCategories import TermDocMatrixWithoutCategories
    164 from scattertext.termranking.TermRanker import TermRanker
--> 165 from scattertext.continuous.trend_plot import TrendPlotSettings, DispersionPlotSettings, CorrelationPlotSettings, \
    166     TimePlotSettings, TimePlotPositioner
    167 from scattertext import SampleCorpora
    168 from scattertext import termscoring

File ~/miniforge3/envs/econ_geo/lib/python3.11/site-packages/scattertext/continuous/trend_plot.py:15
     13 from scattertext.termranking.TermRanker import TermRanker
     14 from scattertext.TermDocMatrix import TermDocMatrix
---> 15 from scattertext.Scalers import get_scaler_name, scale_center_zero_abs, scale, dense_rank
     16 from scattertext.smoothing.mean_isotonic import MeanIsotonic
     19 @dataclasses.dataclass
     20 class TrendPlotPresets:

ImportError: cannot import name 'get_scaler_name' from 'scattertext.Scalers' (/miniforge3/envs/econ_geo/lib/python3.11/site-packages/scattertext/Scalers.py)

I'm not really sure if there is a conflict of names or documents. I have no other files in the workspace with scattertext names.

Environment

JasonKessler commented 3 weeks ago

I'm away from a computer where I can further debug this, but if possible, please use the latest version of Scattertext, currently 0.2.1.

It may be best to install Scattertext from a fresh Py 3.11 virtual environment.

On Tue, Jun 25, 2024 at 12:13 PM Javier Gonzalez @.***> wrote:

Descrioption

I tried to import the package and get an error

import scattertext as st

and get the following error:


ImportError Traceback (most recent call last) Cell In[50], line 2 1 # Let's use the scatter text thingy ----> 2 import scattertext as st

File ~/miniforge3/envs/econ_geo/lib/python3.11/site-packages/scattertext/init.py:165 163 from scattertext.TermDocMatrixWithoutCategories import TermDocMatrixWithoutCategories 164 from scattertext.termranking.TermRanker import TermRanker --> 165 from scattertext.continuous.trend_plot import TrendPlotSettings, DispersionPlotSettings, CorrelationPlotSettings, \ 166 TimePlotSettings, TimePlotPositioner 167 from scattertext import SampleCorpora 168 from scattertext import termscoring

File ~/miniforge3/envs/econ_geo/lib/python3.11/site-packages/scattertext/continuous/trend_plot.py:15 13 from scattertext.termranking.TermRanker import TermRanker 14 from scattertext.TermDocMatrix import TermDocMatrix ---> 15 from scattertext.Scalers import get_scaler_name, scale_center_zero_abs, scale, dense_rank 16 from scattertext.smoothing.mean_isotonic import MeanIsotonic 19 @dataclasses.dataclass 20 class TrendPlotPresets:

ImportError: cannot import name 'get_scaler_name' from 'scattertext.Scalers' (/miniforge3/envs/econ_geo/lib/python3.11/site-packages/scattertext/Scalers.py)

I'm not really sure if there is a conflict of names or documents. I have no other files in the workspace with scattertext names. Environment

  • Scattertext version (v0.1.19):
  • OS (e.g., Linux): MacOS
  • How you installed Scattertext: installed using pip and forcing v0.1.19
  • Initial install command: pip install scattertext it just installs v0.1.10
  • Forced install command pip install -Iv scattertext==0.1.19
  • Python version: 3.11.9
  • I have also tried installing: the packages jieba, spacy, empath, astropy, flashtext, gensim and umap-learn.

— Reply to this email directly, view it on GitHub https://github.com/JasonKessler/scattertext/issues/135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACMMXFTZQVLAB44ECVIZNDZJG6NTAVCNFSM6AAAAABJ4OK7Q2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3TGNBVG4ZDGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jjgecon commented 3 weeks ago

using the pip installer I could only access the 0.1.19 version.

JasonKessler commented 3 weeks ago

Maybe try to install directly from github. Creating a new virtual environment using

$ conda create --name st311 python=3.11

and running, in the environment,

(st311) $ pip install -U scattertext

installed 0.2.1

On Tue, Jun 25, 2024 at 1:14 PM Javier Gonzalez @.***> wrote:

using the pip installer I could only access the 0.1.19 version.

— Reply to this email directly, view it on GitHub https://github.com/JasonKessler/scattertext/issues/135#issuecomment-2189888129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACMMXCB5CKPSES73OHQKY3ZJHFS7AVCNFSM6AAAAABJ4OK7Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBZHA4DQMJSHE . You are receiving this because you commented.Message ID: @.***>

jjgecon commented 3 weeks ago

It upgraded to 0.2.1 (not sure how this worked now and not when I tried it earlier)

Thanks for the help ;D