Comments (8)
That's really odd. It seems like it's trying to execute line 2242 of "ConsIndShockModel.py" without also executing line 2243, which is what the + \ at the end is telling it to do
Are you using Spyder? How are you executing Python code? Have you changed any of the files at all?
from hark.
I found that changing line 2242 into
raise Exception("grid_type not recognized in init." +
"Please ensure grid_type is 'linear' or 'exp_mult'")
solves the problem (at least for the first line error I mentioned).
Was it due to different versions of Python? I run it in Python 3 Jupyter notebook.
from hark.
Hmmmmm yeah that sounds very possible. HARK is written for and tested in Python 2.7
I'd recommend downloading and installing Python 2.7 if you want to use HARK. If that doesn't fix the problem, please let me know
from hark.
Thanks David. I'll just check how far it can go with Python 3.
from hark.
I can confirm that the error described above occurs under python 3, but not python 2.
Here is my effort to run the demo with Python 3:
$ cd ~/workspace/HARK/ConsumptionSaving/
$ python3 Demo.py
Traceback (most recent call last):
File "Demo.py", line 27, in <module>
from ConsIndShockModel import IndShockConsumerType
File "/home/npalmer/workspace/NEW_HARK/ConsumptionSaving/ConsIndShockModel.py", line 2242
raise Exception, "grid_type not recognized in __init__." + \
^
SyntaxError: invalid syntax
...the same error.
Under Python2.7:
$ python Demo.py
divide by zero encountered in log
Consumption functions:
MPC out of Credit v MPC out of Income
$
As @dclow noted, HARK has been written for Python 2.7; unfortunately this appears to be one of the places that Python 2/3 differences crop up. Ideally our code would run under both, but as noted above it has only been tested in Python 2.7. There may be more to be said on this.
Thanks for catching this. (Not closing the issue just yet.)
from hark.
@compumetrika @dclow Thanks for the help. I also confirmed that I could run it on Python 2.7 on my machine without any issues.
from hark.
Should we close this issue now, and replace it with one entitled "make HARK compatible with Python 3"?
from hark.
Closing because no one has objected to my suggestion for three months.
from hark.
Related Issues (20)
- Modifications to A Gentle Introduction to HARK
- Myst implicit targets not working locally HOT 2
- Feature request: markov chains
- ConsBequestModel.py, ConsWealthPortfolioModel, and their inheritances HOT 12
- Align 'new python model' format with recent language research outcomes
- Configurable mortality and aging in an AgentTypeMonteCarloSimulator HOT 1
- YAML config file to New Python Model Format (NPMF)
- NPMF for ConsIndShock HOT 4
- utilities.py: metadata bug in make_figs() HOT 7
- IndexError when solving ConsPortfolioModel HOT 2
- PermShk's are not random enough HOT 2
- We should not use both `seed` and `RNG`. HOT 4
- ImportError: cannot import name 'generated_jit' from 'numba' HOT 4
- Module not found... numpy? HOT 6
- calc_stable_points is being run when it shouldn't be
- ConsBequestModel and related example notebooks HOT 1
- Improve contributor guide with respect to API documentation
- What is update? How many terminal solutions? HOT 8
- Inheritance... HOT 4
- Proposed constructed input framework HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hark.