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

Unable to compile contracts on Windows machine #689

Open
afcharliekong opened this issue May 20, 2022 · 11 comments
Open

Unable to compile contracts on Windows machine #689

afcharliekong opened this issue May 20, 2022 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@afcharliekong
Copy link

Describe the bug

I'm facing a couple of issues when using Algo Builder to compile contracts on windows machine. I've attached the screenshots as shown below.

  1. This occurs because the framework uses python3 command to compile the contracts. I'm currently using anaconda python virtual environment on Windows 10. It uses python instead.

Screenshot 2022-05-20 at 6 37 28 PM

  1. This occurs after I've updated the file in node_modules/@algo-builder/runtime/build/lib/pycompile-op.js to use python instead of python3.

Screenshot 2022-05-20 at 6 40 20 PM

I believe issue 2 is because of the different error numbers used by nodeJS for mac and windows machines. I had to replace the e?.errno === -2 with e?.errno === -4058 on line number 103 so that framework can detect missing generated yaml files and continue the process of compilation. The file is located in /node_modules/@algo-builder/algob/build/lib/compile.js

Possible Solution

  1. Not sure if there's a way to try running the compilation with python3 or python or py.
  2. Maybe we can detect the OS and dynamically change the error number detection accordingly?

Steps to Reproduce

  1. Run yarn run algob compile on a new Algo Builder project on Windows 10.

Environment

  • OS: Windows 10, Windows 11
  • Node.js version: v16.15.0
  • algob version: 3.2.0
  • Python: 3.9.12 (using anaconda)
@afcharliekong afcharliekong added the bug Something isn't working label May 20, 2022
@vuvoth
Copy link
Contributor

vuvoth commented May 20, 2022

Thank @afcharliekong for report the issue! Could you share your source code?

@vuvoth
Copy link
Contributor

vuvoth commented May 20, 2022

I also recommend use window WSL when work with algob.

@afcharliekong
Copy link
Author

afcharliekong commented May 20, 2022

Hi @vuvoth, I've attached the source code of a new Algo Builder project with the changes made in these files,

node_modules/@algo-builder/runtime/build/lib/pycompile-op.js (lines 85, 89)
node_modules/@algo-builder/algob/build/lib/compile.js (lines 103)

Hope it helps.

I had windows WSL installed as well when this compilation issue occured.

algo-builder.zip

@vuvoth
Copy link
Contributor

vuvoth commented May 20, 2022

I had windows WSL installed as well when this compilation issue occured.

Did you install pyteal and pyyaml before run compile, @afcharliekong ?

I had to replace the e?.errno === -2 with e?.errno === -4058 on line number 103 so that framework can detect missing generated yaml files and continue the process of compilation.

Let change it back to default value.

@afcharliekong
Copy link
Author

Hey @vuvoth, I did have pyteal and pyyaml installed. Did a pip list to verify this.

Screenshot 2022-05-21 at 12 49 48 PM

@robert-zaremba
Copy link
Member

What's your python version (when you run python)? It must be 3.9 or later , latest PyTEAL supports only Python 3.10 in fact, which will be required in our upcoming release (algo-builder v4.0).

@afcharliekong
Copy link
Author

I'm running python version 3.9.12 on my anaconda virtual environment.

image

@robert-zaremba
Copy link
Member

Could you try to use Pipenv? https://algobuilder.dev/guide/README#pyteal

BTW, we have just released Algo Builder v4.0. It requires Python 3.10 (this is due to PyTEAL - it's latest release requires Python 3.10).

@afcharliekong
Copy link
Author

Hey @robert-zaremba,

I've switched to Python 3.10
python310

Also using Pipenv and these are the packages installed based on the Pipfile in the repo,
pip-packages

Tried to setup a clean installation using v4.0
algobuilder4

And there's a new error instead =(
js-error

@robert-zaremba
Copy link
Member

hmm, could be related to Node... What is your version of Node.js? node --version? We require v16 or later.

@afcharliekong
Copy link
Author

I'm using node v16.15.0

node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants