Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tessa not working on Google Colab #7

Closed
firmai opened this issue Jun 7, 2022 · 8 comments
Closed

Tessa not working on Google Colab #7

firmai opened this issue Jun 7, 2022 · 8 comments

Comments

@firmai
Copy link

firmai commented Jun 7, 2022

I am in a simple colab environment, and can't get the pypi install to work, let me know if you understand whats going on.
image

@ymyke
Copy link
Owner

ymyke commented Jun 8, 2022

Strange. That's from a Jupyter notebook? What happens if you leave out the version specification?

@firmai
Copy link
Author

firmai commented Jun 8, 2022

Same problem when I leave out the version specification, can you replicate it on Colab?

@ymyke
Copy link
Owner

ymyke commented Jun 19, 2022

I gave this a try now and I get the same error as you in Colab. I assume the issue is because Colab runs Python v3.6 whereas tessa currently requires v3.9. – I will check if I can make this more lenient. See also #8

@ymyke ymyke changed the title Pypi not working Tessa not working on Google Colab Jun 19, 2022
@ymyke
Copy link
Owner

ymyke commented Jun 20, 2022

Turns out that Google Colab runs Python 3.7. I just released v0.3.1 which should work with >=3.7, <3.10. I tested with Colab and it works there too.

(Nonrelated, but maybe useful in case you ever need to upgrade the Python environment in Colab: https://stackoverflow.com/questions/68657341/how-can-i-update-google-colabs-python-version)

@ymyke ymyke closed this as completed Jun 20, 2022
@danilogalisteu
Copy link

danilogalisteu commented Jun 28, 2022

I'm not able to run the basic example on Colab.

!python --version
!pip install tessa==0.3.1

installed everything:

Python 3.7.13
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Requirement already satisfied: tessa==0.3.1 in /usr/local/lib/python3.7/dist-packages (0.3.1)
Requirement already satisfied: pycoingecko>=2.2 in /usr/local/lib/python3.7/dist-packages (from tessa==0.3.1) (2.2.0)
Requirement already satisfied: pendulum>=2.1 in /usr/local/lib/python3.7/dist-packages (from tessa==0.3.1) (2.1.2)
Requirement already satisfied: frozendict>=2.3 in /usr/local/lib/python3.7/dist-packages (from tessa==0.3.1) (2.3.2)
Requirement already satisfied: investpy>=1 in /usr/local/lib/python3.7/dist-packages (from tessa==0.3.1) (1.0.8)
Requirement already satisfied: lxml>=4.4.1 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (4.9.0)
Requirement already satisfied: numpy>=1.17.2 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (1.21.6)
Requirement already satisfied: requests>=2.22.0 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (2.23.0)
Requirement already satisfied: Unidecode>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (1.3.4)
Requirement already satisfied: pandas>=0.25.1 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (1.3.5)
Requirement already satisfied: setuptools>=41.2.0 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (57.4.0)
Requirement already satisfied: pytz>=2019.3 in /usr/local/lib/python3.7/dist-packages (from investpy>=1->tessa==0.3.1) (2022.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.1->investpy>=1->tessa==0.3.1) (2.8.2)
Requirement already satisfied: pytzdata>=2020.1 in /usr/local/lib/python3.7/dist-packages (from pendulum>=2.1->tessa==0.3.1) (2020.1)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.25.1->investpy>=1->tessa==0.3.1) (1.15.0)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests>=2.22.0->investpy>=1->tessa==0.3.1) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests>=2.22.0->investpy>=1->tessa==0.3.1) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests>=2.22.0->investpy>=1->tessa==0.3.1) (2022.6.15)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests>=2.22.0->investpy>=1->tessa==0.3.1) (1.24.3)

but the code:

from tessa import price_history
df, currency = price_history("Australia 30Y", "bond")

failed:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-2-e427b538f43f>](https://localhost:8080/#) in <module>()
----> 1 from tessa import price_history
      2 df, currency = price_history("Australia 30Y", "bond")

[/usr/local/lib/python3.7/dist-packages/tessa/__init__.py](https://localhost:8080/#) in <module>()
      1 __version__ = "0.3.1"
      2 
----> 3 from .price import price_history, price_point, price_point_strict, price_latest
      4 from .search import search

[/usr/local/lib/python3.7/dist-packages/tessa/price.py](https://localhost:8080/#) in <module>()
     11 
     12 @freezeargs
---> 13 @functools.cache
     14 def price_history(
     15     query: str, type_: str, country: str = None, currency_preference: str = "usd"

AttributeError: module 'functools' has no attribute 'cache'

Before Python 3.9, the decorator is functools.lru_cache instead. I can't see how it could work on Python 3.7. How did you test it @ymyke?

@ymyke
Copy link
Owner

ymyke commented Jul 1, 2022

I published v0.3.2 just now, which should finally work in Colab. Can you confirm, @danilogalisteu ?

@danilogalisteu
Copy link

v0.3.2 is working in Google Colab with Python 3.7.13. I'm not able to test on Python 3.9 at the moment. Thanks!

@ymyke
Copy link
Owner

ymyke commented Jul 2, 2022

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants