Unable to init server: Could not connect: Connection refused

Hi Tryton team;

I was working in tryton version 5.0 from a long time in a virtualenvironmentA on a Linux server and today i decided to work with two versions, so i have gone and i installed tryton version 6.0 in another virtual environment, but Unfortunately, after installing tryton and trytond with those two commands:

pip3 install trytond=6.0.0
pip3 install pygobject tryton==6.0.0

i was about seeing my version in this virtual environement to confirm that everything is good with the command tryton --version

response was:

Unable to init server: Could not connect: Connection refused
(tryton:12200): Gtk-WARNING **: 10:55:20.878: Locale not supported by C library.
	Using the fallback 'C' locale.
Unable to init server: Could not connect: Connection refused

(tryton:12200): Gtk-ERROR **: 10:55:21.084: Can't create a GtkStyleContext without a display connection

and lastly when i have gone to my version 5.0 to see that the environment has not be affected , but the same error displayed when i put tryton --version and trytond version become 6.0 not 5.0.

what does mean this error, and how i can fix my previous version to back to her first version and i want to know my work it can be affected if i will update now my database in the previous version!

Any advices please! .Thanks!

It seems that you do not have a server running the 6.0 series, so you can not connect to it.

And what about the server trytond that exist in another virtual environment version 5.0 it becomes 6.0, is it normal and if i will update my database over there in my version 5.0, it will be affected ?

To me, it seems you forgot to activate your virtual environment, so you installed tryton version 6.0 globally. To test that, just make sure you don’t have any virtual environment active and execute the command trytond-admin --version. If it comes back with information, you have globally installed tryton.
The best way I can think of is to remove it again (with pip) and see if everything is ok with your 5.0 environment. Then create a new virtual environment for 6.0 and activate it and install version 6.0.
Also you cannot run both version at the same port. Default this port is 8000, but one of the version should run on another port e.g. 8060. You have to set that up in your trytond.conf

When upgrading from 5.0 to 6.0 I personally will do the small steps, so go from 5.0 to 5.2 and so on until 6.0

This is not required. You can skip series on the upgrade. Just need to take care of executing the migration notices from all versions.

We migrated databases from 3.8 to 6.0 in a single step.

yeah unfornatully i found that the trytond was installed globaly , version 6.0.0 , which command i should use to unistall this version 6.0.0 and keep my old version 5.0

Make sure you don’t have any virtual environment activated. Then do a

pip3 uninstall trytond
pip3 uninstall pygobject tryton

basically the commands you have used but now using uninstall. I think when you have uninstalled tryton, you will be able to run tryton version 5.0 from within you virtual environment again. Because you run tryton version 5 in a virtual environment, this installation should not be affected but Python first takes the global packages before using the virtual environment one.

BTW, if you want to run more version alongside each other, make sure you also use separate databases as well.

Well it’s my personal preference to do it one step at a time because I’m always walk into trouble when doing big steps :cry:

after type those two commands globally
i have go to my virtual environement 5.0
and when i typed tryton --version and trytond --version

response was ;
-bash: trytond: command not found

after updating the database it gives me -bash: trytond-admin: command not found

Did you activate the virtual environment with . bin/activate ?

should i type this command inside the virtual environment of 5.0?

Yes, cd into your virtual environment and then execute the command to activate your virtual environment.

Am using linux i go to my virtual environement by workon name_project; otherwise again when i update my database there was another error in my version 5.0 :

20549 139930273048384 [2021-09-10 12:50:14,954] MainProcess INFO trytond.modules account_statement_aeb43:registering classes
Traceback (most recent call last):
  File "trytond/bin/trytond-admin", line 21, in <module>
  File "/home/caroline/venv/project/trytond/trytond/admin.py", line 53, in run
  File "/home/caroline/venv/project/trytond/trytond/pool.py", line 149, in init
  File "/home/caroline/venv/project/trytond/trytond/pool.py", line 102, in start
  File "/home/caroline/venv/project/trytond/trytond/modules/__init__.py", line 333, in register_classes
    the_module = import_module(module)
  File "/home/caroline/venv/project/trytond/trytond/modules/__init__.py", line 53, in import_module
    module = importlib.import_module(fullname)
  File "/home/caroline/venv/project/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/caroline/venv/project/trytond/trytond/modules/account_statement_aeb43/__init__.py", line 5, in <module>
    from . import statement
  File "/home/caroline/venv/project/trytond/trytond/modules/account_statement_aeb43/statement.py", line 6, in <module>
    from csb43 import csb43
  File "/home/caroline/venv/project/lib/python3.7/site-packages/csb43/csb43/__init__.py", line 25, in <module>
    from .csb_file import File, ClosingFile  # noqa: F401
  File "/home/caroline/venv/project/lib/python3.7/site-packages/csb43/csb43/csb_file.py", line 11, in <module>
    from .account import Account
  File "/home/caroline/venv/project/lib/python3.7/site-packages/csb43/csb43/account.py", line 12, in <module>
    from ..utils.compat import (
  File "/home/caroline/venv/project/lib/python3.7/site-packages/csb43/utils/__init__.py", line 20, in <module>
    from ..i18n import tr as _
  File "/home/caroline/venv/project/lib/python3.7/site-packages/csb43/i18n/__init__.py", line 30, in <module>
    languages += DEFAULT_LANGUAGES
NameError: name 'languages' is not defined

What says trytond-admin --version now?

Did you do a database upgrade when version 6.0 was installed?

still say -bash: trytond-admin: command not found

No i did’nt do any upgrade of database

ps: when i do trytond/bin/trytond-admin it doesn’t give me any response of error but it goes normally

That’s weird, why are you able to run the upgrade database command? Which command do you use for that?

trytond/bin/trytond-admin -vv -c trytond.conf -d database_tryton --all

Ah, I see, you didn’t install Trytond in your environment with pip. Looking at your error, the problem seems to be in a package called csb43 and it looks like @pokoli can help you with that.

But this is my old version 5.0 , previously it works normally , so should i install again trytond version 5.0!