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

Version Handling Issue #1288

Closed
Antony-M1 opened this issue Dec 9, 2023 · 10 comments
Closed

Version Handling Issue #1288

Antony-M1 opened this issue Dec 9, 2023 · 10 comments

Comments

@Antony-M1
Copy link
Contributor

Description of the issue

One Year ago I used frappe-docker to develop and deploy the project. but now I'm trying to install on my local machine for Version-13. its not working the reason is the bench version its using the default version bench means the latest version. it will work for Version-14 & Version-15 the latest version is not compatible for the Version-13. I need to do in version-13. this really hard if Version-16 comes the bench version will me move on after some days Version-14 won't work in frappe-docker because its using latest version of bench please. handle in separate branch. or else provide some command to modify the bench version.

Context information (for bug reports)

Steps to reproduce the issue

Observed result

Expected result

Stacktrace / full error message if available

frappe@862a330f9ef1:/workspace/development$ bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
Setting Up Environment
$ python3 -m venv env
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet wheel
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-13 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 3016, done.
remote: Counting objects: 100% (3016/3016), done.
remote: Compressing objects: 100% (2680/2680), done.
remote: Total 3016 (delta 406), reused 1436 (delta 264), pack-reused 0
Receiving objects: 100% (3016/3016), 17.32 MiB | 5.01 MiB/s, done.
Resolving deltas: 100% (406/406), done.
Installing frappe
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /workspace/development/frappe-bench/apps/frappe 
ERROR: Ignored the following yanked versions: 3.6.0a1, 5.3a1.dev0
ERROR: Ignored the following versions that require a different python version: 5.1 Requires-Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.10; 5.2 Requires-Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.11; 5.2a1.dev0 Requires-Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.11; 5.3 Requires-Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.11; 5.4 Requires-Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.11
ERROR: Could not find a version that satisfies the requirement RestrictedPython~=5.4 (from frappe) (from versions: 3.4.2, 3.4.3, 3.5.0, 3.5.1, 3.5.2, 3.6.0, 4.0a1, 4.0a2, 4.0a3, 4.0b1, 4.0b2, 4.0b3, 4.0b4, 4.0b5, 4.0b6, 4.0b7, 4.0b8, 4.0, 5.0, 6.0a1.dev0, 6.0, 6.1, 6.2, 7.0a1.dev0, 7.0a1.dev1, 7.0a2.dev0, 7.0)
ERROR: No matching distribution found for RestrictedPython~=5.4
subprocess.CalledProcessError: Command '/workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /workspace/development/frappe-bench/apps/frappe ' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/frappe/.bench/bench/commands/make.py", line 75, in init
    init(
  File "/home/frappe/.bench/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.bench/bench/utils/system.py", line 87, in init
    get_app(
  File "/home/frappe/.bench/bench/app.py", line 444, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/home/frappe/.bench/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.bench/bench/app.py", line 242, in install
    install_app(
  File "/home/frappe/.bench/bench/app.py", line 573, in install_app
    bench.run(
  File "/home/frappe/.bench/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.bench/bench/utils/__init__.py", line 158, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /workspace/development/frappe-bench/apps/frappe 

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-bench"
@Antony-M1 Antony-M1 added the bug label Dec 9, 2023
@dvdl16
Copy link

dvdl16 commented Dec 9, 2023

Are you using the right PYENV_VERSION and NodeJS version?

e.g.

nvm use v14
PYENV_VERSION=3.9.17 bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
cd frappe-bench

https://github.com/frappe/frappe_docker/blob/main/docs/development.md#setup-first-bench

@Antony-M1
Copy link
Contributor Author

@dvdl16 Yes im using the correct version you mentioned.

After I'm getting the error. I click N instead of Y to check the python version. surprisingly its showing this version of python 3.11.6

image

@Antony-M1
Copy link
Contributor Author

Getting this error while running this command

command

PYENV_VERSION=3.9.17 bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench

error

frappe@0904d5427b49:/workspace/development$ PYENV_VERSION=3.9.17 bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench-4
Setting Up Environment
pyenv: version `3.9.17' is not installed (set by PYENV_VERSION environment variable)
ERROR: venv cannot be found
$ None env
Traceback (most recent call last):
  File "/home/frappe/.bench/bench/commands/make.py", line 75, in init
    init(
  File "/home/frappe/.bench/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.bench/bench/utils/system.py", line 66, in init
    bench.setup.env(python=python)
  File "/home/frappe/.bench/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.bench/bench/bench.py", line 362, in env
    self.run(f"{venv} env", cwd=self.bench.name)
  File "/home/frappe/.bench/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.bench/bench/utils/__init__.py", line 154, in exec_cmd
    return_code = subprocess.call(spl_cmd, cwd=cwd, universal_newlines=True, env=env)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/subprocess.py", line 389, in call
    with Popen(*popenargs, **kwargs) as p:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'None'

ERROR: There was a problem while creating frappe-bench-4
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-bench-4"
frappe@0904d5427b49:/workspace/development$

Note: I tried these many compination same above error gettong

  • PYENV_VERSION=3.9.17
  • PYENV_VERSION=3.9.18
  • PYENV_VERSION=3.9

@Antony-M1
Copy link
Contributor Author

After Doing the Remote-Containers: Reopen in Container I checked my sytem the python version its showing

3.11.6

but for another teammate have version

3.10.12

for him working fine. really good. i don't know why

@revant
Copy link
Collaborator

revant commented Dec 9, 2023

You can install py and nodejs version you need using pyenv and nvm.

You can move back to commit you wish for bench as the source is located in /home/frappe/.bench

Another suggestion is to push your desired image to a private registry where you can maintain any version you need.

There was a PR that tagged version for benches you can use the tagged image, https://hub.docker.com/r/frappe/bench/tags

Tags available v5.16.4 onwards

@Antony-M1
Copy link
Contributor Author

@revant Actually one of my teammate system i checked now. there i can see the python version 3.10.12 but for me its showing 3.11.6 even i completely removed from my system. plesae help me how to do this

You can install py and nodejs version you need using pyenv and nvm.

but for her working fine. I don't understand. I'm using Ubuntu 22.04.

Im checking the python version after running this command

Remote-Containers: Reopen in Container

I'm super confused

@Antony-M1
Copy link
Contributor Author

Antony-M1 commented Dec 9, 2023

This Solution Worked For Me

pyenv install 3.9.18
nvm install v14
nvm use v14
PYENV_VERSION=3.9.18 bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench

If any error comes in yarn

use this command

npm install -g yarn

@Henry-Do-Su
Copy link

For anyone running the ./installer script, you can also get the same error. Make sure you check node -v and python -V, and use this in your flags when running it, for example: ./installer.py -t version-15 -p 3.11.6 -n v18.18.2 -j apps.json -v
The frappe-bench error stopped happening after that

Copy link
Contributor

This issue has been automatically marked as stale. You have a week to explain why you believe this is an error.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2024
@saru2020
Copy link

I'm using the /installer.py script and no solutions provided worked for me, I had to find my own:
init_command += "npm install -g yarn && "
Add this in line 132 along with bench install command and
make sure to add --node-version flag [for example: python installer.py --db-type postgres --node-version v18]
and it should work!

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

No branches or pull requests

5 participants