Open mmcky opened 1 year ago
I'll try to write the report in this thread itself and edit it until we complete it.
There are two issues. The first one is minor which requires modifying the code and adding a single line: %pip install distutils
. This fixes the following issue:
ModuleNotFoundError: The module 'distutils' is unvendored from the Python standard library in the Pyodide distribution.
You can install it by calling:
await micropip.install("distutils") in Python, or
await pyodide.loadPackage("distutils") in JavaScript
See https://pyodide.org/en/stable/usage/loading-packages.html for more details.
Once, that is fixed, there's another error arising from the following snippet:
>>> import wbgapi as wb
>>> wb.series.info(q='GDP growth')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[16], line 1
----> 1 wb.series.info(q='GDP growth')
TypeError: info() got an unexpected keyword argument 'q'
One issue might be that it uses an older version. I tried fixing that by using %pip install wbgapi==1.0.12
that gave the following error:
File /lib/python3.11/site-packages/micropip/_micropip.py:373, in Transaction.check_version_satisfied(self, req)
369 if req.specifier.contains(ver, prereleases=True):
370 # installed version matches, nothing to do
371 return True
--> 373 raise ValueError(
374 f"Requested '{req}', " f"but {req.name}=={ver} is already installed"
375 )
ValueError: Requested 'wbgapi==1.0.12', but wbgapi==1.1.2 is already installed
I used 1.0.12
as it is the latest version according to https://pypi.org/project/wbgapi/ and is not sure how piplite
finds version 1.1.2
.
The issue is that the yfinance
package is unable to download data. The following cell reproduces the error:
import yfinance as yf
s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Adj Close']
And throws the following error:
[*********************100%***********************] 1 of 1 completed
1 Failed download:
- CT=F: No timezone found, symbol may be delisted
The version installed in pyodide
is '0.2.18'
.
I verified by installing the same version of yfinance
on my local machine and that worked perfectly.
It might be good to look into the issue if we can download data or not.
There are 3 primary issues in the lecture.
--upgrade
flag and the fix is easy i.e. to drop the --upgrade
flag.interpolation
package, and throws the following error:
ValueError: Requested 'packaging<22.0,>=21.3', but packaging==23.0 is already installed
quantecon
: #15 Installation of graphviz
does work fine but that's not enough to provide its support. It requires explicit installation apart from pip
install like the one here: https://github.com/QuantEcon/lecture-python-intro/pull/171.
It was discussed that probably the best way to tackle this is to drop graphviz
and use static images instead. See: https://github.com/QuantEcon/lecture-python-intro/issues/186
There are some code cells that take so long to run:
>>> import scipy.stats as st
>>> means_violin_plot(st.norm(loc=5, scale=2)) # takes 50 seconds to complete.
>>> means_violin_plot(st.beta(6, 6)) # takes 2m 27 seconds to complete.
There is a memory error using the following code snippet:
# Set parameters
n = 250 # Choice of n
k = 1_000_000 # Number of draws of Y_n
distribution = st.expon(2) # Exponential distribution, λ = 1/2
μ, σ = distribution.mean(), distribution.std()
data = distribution.rvs((k, n))
Error:
```console
MemoryError: Unable to allocate 1.86 GiB for an array with shape (1000000, 250) and data type float64
It might be good to use smaller dimensions to reduce the computations. I tried to fix 2nd issue with k = 10000
and that worked fine.
There's an error while executing the following code cell:
data = pd.read_excel("datasets/mpd2020.xlsx", sheet_name='Full data')
data
Error:
ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl.
The fix is easy. It requires to include the following code cell at the top:
%pip install openpyxl
Once we add this, the whole lecture works fine.
Installing ortools
throws an error with %pip install ortools
:
ValueError: Can't find a pure Python 3 wheel for 'ortools'.
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
You can use `micropip.install(..., keep_going=True)`to get a list of all packages with missing wheels.
The fix is a tough one. We can't find a pure Python wheel of ortools
as it just has a Python API for performance reasons and the lecture has a major dependency on ortools
. We might probably need to drop ortools
.
First issue is a simple one which includes removing --upgrade
flag from pip
and also install seaborn
. So the following line fixes everything:
%pip install yfinance seaborn
Another issue is that yfinance
is unable to download the data, see the following cell:
import yfinance as yf
df = yf.download('AMZN', '2000-1-1', '2023-1-1', interval='1mo' )
This outputs:
[*********************100%***********************] 1 of 1 completed
1 Failed download:
WASM Project
Goal: Enable
QuantEcon
to make a decision to use or not to use WASM for Africa July 2023lectures
(i.e. technical issues, execution time issues etc.) (@Smit-create prepare report from the findings)LMS
(see suggestion below for structure) so we can identify how many are solvable solutions and how many require further investigation. (@Smit-create prepare report from the findings)Compile a
report
and for each issue we want to identifyIssue Description:
< Describe the issue found >
Issue Type: [Technical, User Facing]
Example Code Snippet:
< self contained code snippet that replicates the issue >
Suggested Solutions:
< list of possible solutions >
jit
function from QuantEcon.py and test this with a lecture that usesjit
to see if it is useful enough withoutjit
compilation for the purposes of teaching