ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Update to python 3 - OSError: [Errno 18] Invalid cross-device link


#1

ERPNext: v12.0.2 (version-12)
Frappe Framework: v12.0.2 (version-12)
Docker container: https://github.com/Ridhosribumi/docker-erpnext

I am trying to update from python2.7 to python3.5 with the bench command:

bench migrate-env python3

I get the following error:

DEBUG:bench.commands:Clearing Redis Cache...
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHALL
OK
DEBUG:bench.commands:Clearing Redis DataBase...
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHDB  
OK 
DEBUG:bench.commands:Backing up Virtual Environment  
DEBUG:bench.commands:Migration Error
Traceback (most recent call last):
File "/usr/local/bin/bench", line 11, in <module>
load_entry_point('bench', 'console_scripts', 'bench')()
File "/home/frappe/.bench/bench/cli.py", line 40, in cli
bench_command()
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/frappe/.bench/bench/commands/__init__.py", line 139, in migrate_env
os.rename(source, dest)
OSError: [Errno 18] Invalid cross-device link

Did anyone else had the same problem? How can it be approaches?
I’d be thankful for any hint.


#2

I am also having trouble migrating v12 to python3

frappe@server2:~/frappe-bench$ bench migrate-env python3
DEBUG:bench.commands:Clearing Redis Cache...
INFO:bench.utils:/usr/local/bin/redis-cli -p 13001 FLUSHALL
OK
DEBUG:bench.commands:Clearing Redis DataBase...
INFO:bench.utils:/usr/local/bin/redis-cli -p 13001 FLUSHDB
OK
DEBUG:bench.commands:Backing up Virtual Environment
DEBUG:bench.commands:Setting up a New Virtual python3 Environment
INFO:bench.utils:/usr/local/bin/virtualenv --python /usr/bin/python3 /home/frappe/frappe-bench/env
Running virtualenv with interpreter /usr/bin/python3
New python executable in /home/frappe/frappe-bench/env/bin/python3
Also creating executable in /home/frappe/frappe-bench/env/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /home/frappe/frappe-bench/env/bin/python3 - setuptools pip wheel:
  /usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/download.py", line 36, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/utils/ui.py", line 15, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/progress/bar.py", line 48
    empty_fill = u'\u2219'
                      ^
SyntaxError: invalid syntax
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2327, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 944, in create_environment
    download=download,
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/frappe/frappe-bench/env/bin/python3 - setuptools pip wheel failed with error code 1
DEBUG:bench.commands:Migration Error
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/__init__.py", line 159, in migrate_env
    ), cwd = path)
  File "/home/frappe/bench-repo/bench/utils.py", line 161, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: /usr/local/bin/virtualenv --python /usr/bin/python3 /home/frappe/frappe-bench/env
frappe@server2:~/frappe-bench$

#3

After using bench setup socketio I am receiving this error now:

frappe@server2:~/frappe-bench$ bench migrate-env python3
DEBUG:bench.commands:Clearing Redis Cache...
INFO:bench.utils:/usr/local/bin/redis-cli -p 13001 FLUSHALL
OK
DEBUG:bench.commands:Clearing Redis DataBase...
INFO:bench.utils:/usr/local/bin/redis-cli -p 13001 FLUSHDB
OK
DEBUG:bench.commands:Backing up Virtual Environment
DEBUG:bench.commands:Migration Error
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/__init__.py", line 139, in migrate_env
    os.rename(source, dest)
OSError: [Errno 2] No such file or directory
frappe@server2:~/frappe-bench$ 

Anyone has any idea ? :slight_smile:

Also, I thought of using bench setup requirements but I am receiving another error:

frappe@server2:~/frappe-bench$ bench setup requirements
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
/bin/sh: 1: ./env/bin/pip: not found
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/setup.py", line 161, in setup_requirements
    setup_python_requirements()
  File "/home/frappe/bench-repo/bench/commands/setup.py", line 167, in setup_python_requirements
    update_requirements()
  File "/home/frappe/bench-repo/bench/utils.py", line 429, in update_requirements
    exec_cmd("{pip} install --upgrade pip".format(pip=pip))
  File "/home/frappe/bench-repo/bench/utils.py", line 161, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install --upgrade pip

However, python is already up to do date based on the command output.