ERPNext Conference 2019* ERPNext.com Blog

ERPNext + Python 3

erpnext
frappe
python3

#21
  • very high CPU usage compare to python 2.7

Left side is Python 3 , right side is Python 2.7


#22

Please have a look at the cheatsheet to fix you apps. erpnext_demo is deprecated and no support hence, why are you even using it? Like mentioned, we don’t support them. I highly doubt that’s Python 3 usage. Try profiling the app correctly by targeting the right Process IDs and benchmark. Also you’re using 3.4, care to update to 3.6?


#23

Hi there, could you open an issue for me on GitHub and assign it to me? :smile: Steps to reproduce too!


#24

@achillesrasquinha

Thank you for your thoughts.
Understand your point.
I using the VM virtual image from the download site.
In this case I should wait until it updated and dropped the erpnext_demo from it.
If it is the case could you help to find the way to drop it form the working image?


#25
bench remove-app [APP_NAME]

#26

Quite easy … just run

$ bench migrate-env python3

on an existing bench installation, then bench start and try to access the site at port 8000.

you should get the error … :wink:


#27

Hmm,

unable to replicate. on latest? I’ll check it out.


#28

it was yesterday …let me try today and get back …


#29

Do help me out raising issues, they’re most likely string to bytes, unicode, etc. etc. syntax. Will dispatch fixes immediately!


#30

Will do …migrating now …


#31

#32

Thanks


#33

#34

@achillesrasquinha

Are we not kill UBUNTU 14.04-32bit if we care to install Python 3.6?

"Python 3 is already installed on all currently supported Ubuntu releases. On Ubuntu 14.04, you have Python 3.4. You should normally avoid installing your own Python versions, because the system heavily depends on those which are preinstalled. "

It is not the time to upgrade VM virtual image to UBUNTU 16.04 64bit from UBUNTU 14.04 32bit?

Github issue:


VM for download is now UBUNTU 16.04 and 64 bit !?
#35

Hi,
I’m new to EXPNext but I do know python and I would like to help out by testing new installs on Debian. Here are the steps that I used :slight_smile:

apt update
apt upgrade
locale-gen en_US.UTF-8
apt install -y python3 python3-pip
echo "frappe ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
python3 install.py --production --user frappe --mysql-root-password ***** --admin-password ****

Please let me know if this is the ideal way to do a fresh install

TIA!


#36

https://github.com/pyenv/pyenv could be used to have our own python version if needed


#37

I tried it with PyPy.
It worked seamlessly (almost). I could see some performance improvements too!

Known issues:

  • PyPDF2 merging (using PdfFileWriter class) doesn’t work.

#38

Can you write it up? Maybe a page on the wiki?
And what was the use case for PyPy or was this just an experiment?


#39

Its simple really.

# Add PyPy repository
sudo add-apt-repository ppa:pypy/ppa
sudo apt-get update

# Install relevant packages
sudo apt-get install pypy pypy-dev

# Install dependencies
sudo apt-get install libxml2-dev libxslt1-dev
sudo pip install lxml

# Migrate environment! (execute from your bench instance)
bench migrate-env pypy

This was an experiment, primarily to check out the perfromance of PyPy compared to Python. It advertises 7.6 times faster performance.

I did not test benchmarks, but there was some visible improvement in comparison to Python.

However, it is not as stable as Python. If your instance requires PyPDF2’s merging features, you must use Python. Another alternative might be to make use of both implementations to get a proper balance of performance and stability.


#40

Hello;

I succeeded with bench migrate-env python3 but I am facing problem when I run bench update --reset as I am getting this error:

TypeError: the JSON object must be str, not 'bytes’

I faced the problem of Command "python setup.py egg_info" failed with error code 1 but the solution was by modifying the setup.py file at the repository of the custom application.
(Reference: [Solved]Command “python setup.py egg_info” failed with error code 1).

And below is the details

Updating Python libraries…
INFO:bench.utils:./env/bin/pip install --upgrade pip
Requirement already up-to-date: pip in ./env/lib/python3.5/site-packages (19.0.1)
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q -e ./apps/frappe
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q -e ./apps/erpnext
INFO:bench.app:installing taxi
INFO:bench.utils:./env/bin/pip install -q -e ./apps/taxi
INFO:bench.app:installing travel_agency
INFO:bench.utils:./env/bin/pip install -q -e ./apps/travel_agency
INFO:bench.app:installing notary
INFO:bench.utils:./env/bin/pip install -q -e ./apps/notary
Updating node packages…
INFO:bench.utils:yarn install
yarn install v1.13.0
[1/4] Resolving packages…
success Already up-to-date.
Done in 0.75s.
Backing up sites…
Patching sites…
Migrating site1.local
Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
Updating DocTypes for taxi : [========================================]
Updating DocTypes for travel_agency : [========================================]
Updating DocTypes for notary : [========================================]
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 227, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 53, in migrate
router.sync_global_search()
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/router.py”, line 355, in sync_global_search
sync_global_search()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/global_search.py”, line 314, in sync_global_search
value = json.loads(frappe.cache().lpop(‘global_search_queue’))
File “/usr/lib/python3.5/json/init.py”, line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not ‘bytes’
frappe@Bilal:~/frappe-bench$

ERPNext and Frappe is version 11.1.3 master

Regards
Bilal


New error when running bench update: ./env/bin/pip not found