transifex / transifex-client

The Transifex command-line tool.
https://www.transifex.com/
GNU General Public License v2.0
135 stars 75 forks source link

Cannot install transifex-client in Bitrise #328

Closed luboganev closed 3 years ago

luboganev commented 3 years ago

Environment: Bitrise default Android docker image based on Ubuntu.

We follow exactly the instructions available here: https://docs.transifex.com/client/installing-the-client

The documentation say:

If you use Ubuntu as your operating system, you can use the following command lines: $ sudo apt-get install python-pip $ sudo pip install transifex-client

So we do. We execute the following script:

sudo apt-get install python-pip
sudo pip install 'transifex-client' 
tx --version

And we get the following result:

Reading package lists...
Building dependency tree...
Reading state information...
python-pip is already the newest version (8.1.1-2ubuntu0.6).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Collecting transifex-client
  Downloading https://files.pythonhosted.org/packages/11/c0/c54fd912be3820df880a89e0ce4d393c73a16967fe61f76c7fea53b4ad18/transifex-client-0.14.3.tar.gz (211kB)
Requirement already satisfied (use --upgrade to upgrade): urllib3<2.0.0,>=1.24.2 in /usr/local/lib/python2.7/dist-packages (from transifex-client)
Requirement already satisfied (use --upgrade to upgrade): six<2.0.0 in /usr/local/lib/python2.7/dist-packages (from transifex-client)
Collecting requests<3.0.0,>=2.19.1 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/92/96/144f70b972a9c0eabbd4391ef93ccd49d0f2747f4f6a2a2738e99e5adc65/requests-2.26.0-py2.py3-none-any.whl (62kB)
Collecting python-slugify<5.0.0 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/9f/42/e336f96a8b6007428df772d0d159b8eee9b2f1811593a4931150660402c0/python-slugify-4.0.1.tar.gz
Collecting gitpython<4.0.0 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/9c/cc/13add5b133ba8ad36ae1a0c93e6a6a3f71dad96b271f37e2ffc5bfca1eea/GitPython-3.1.19.tar.gz (187kB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-Kl_V4U/gitpython/setup.py", line 60
        print("Couldn't find file %s to stamp version" % filename, file=sys.stderr)
                                                                       ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Kl_V4U/gitpython/
You are using pip version 8.1.1, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/tmp/bitrise730213733/step_src/._script_cont: line 3: tx: command not found

Help. We are paying customer - Thinxnet GmbH.

transifexGithub commented 3 years ago

Hello luboganev,

This error it's because TX has not being install on your laptop so python doesn't finds TX module, Let's use the following commands and let me know how it goes.

Command 1 sudo pip3 install transifex-client Command 2 sudo pip3 install --upgrade transifex-client Command 3 tx --version 0.14.2, py 3.9, arm

Best Regards

luboganev commented 3 years ago

Thanks for the hint. However, that's not my laptop. I wrote it is a docker Ubuntu image. It doesn't have pip3 so I have to add this before executing the commands you recommended.

Environment

Bitrise default Android docker image based on Ubuntu.

Executed script code

sudo apt-get install python3-pip --assume-yes
sudo pip3 install transifex-client
sudo pip3 install --upgrade transifex-client
tx --version

Script output

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libpython3-dev libpython3.5 libpython3.5-dev python3-dev python3-setuptools
  python3-wheel python3.5-dev
Suggested packages:
  python-setuptools-doc
The following NEW packages will be installed:
  libpython3-dev libpython3.5 libpython3.5-dev python3-dev python3-pip
  python3-setuptools python3-wheel python3.5-dev
0 upgraded, 8 newly installed, 0 to remove and 4 not upgraded.
Need to get 39.4 MB of archives.
After this operation, 59.8 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython3.5 amd64 3.5.2-2ubuntu0~16.04.13 [1,360 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython3.5-dev amd64 3.5.2-2ubuntu0~16.04.13 [37.3 MB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libpython3-dev amd64 3.5.1-3 [6,926 B]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3.5-dev amd64 3.5.2-2ubuntu0~16.04.13 [413 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 python3-dev amd64 3.5.1-3 [1,186 B]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python3-pip all 8.1.1-2ubuntu0.6 [109 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 python3-setuptools all 20.7.0-1 [88.0 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python3-wheel all 0.29.0-1 [48.1 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 39.4 MB in 2s (14.8 MB/s)
Selecting previously unselected package libpython3.5:amd64.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 72766 files and directories currently installed.)
Preparing to unpack .../libpython3.5_3.5.2-2ubuntu0~16.04.13_amd64.deb ...
Unpacking libpython3.5:amd64 (3.5.2-2ubuntu0~16.04.13) ...
Selecting previously unselected package libpython3.5-dev:amd64.
Preparing to unpack .../libpython3.5-dev_3.5.2-2ubuntu0~16.04.13_amd64.deb ...
Unpacking libpython3.5-dev:amd64 (3.5.2-2ubuntu0~16.04.13) ...
Selecting previously unselected package libpython3-dev:amd64.
Preparing to unpack .../libpython3-dev_3.5.1-3_amd64.deb ...
Unpacking libpython3-dev:amd64 (3.5.1-3) ...
Selecting previously unselected package python3.5-dev.
Preparing to unpack .../python3.5-dev_3.5.2-2ubuntu0~16.04.13_amd64.deb ...
Unpacking python3.5-dev (3.5.2-2ubuntu0~16.04.13) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../python3-dev_3.5.1-3_amd64.deb ...
Unpacking python3-dev (3.5.1-3) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../python3-pip_8.1.1-2ubuntu0.6_all.deb ...
Unpacking python3-pip (8.1.1-2ubuntu0.6) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../python3-setuptools_20.7.0-1_all.deb ...
Unpacking python3-setuptools (20.7.0-1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../python3-wheel_0.29.0-1_all.deb ...
Unpacking python3-wheel (0.29.0-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
Setting up libpython3.5:amd64 (3.5.2-2ubuntu0~16.04.13) ...
Setting up libpython3.5-dev:amd64 (3.5.2-2ubuntu0~16.04.13) ...
Setting up libpython3-dev:amd64 (3.5.1-3) ...
Setting up python3.5-dev (3.5.2-2ubuntu0~16.04.13) ...
Setting up python3-dev (3.5.1-3) ...
Setting up python3-pip (8.1.1-2ubuntu0.6) ...
Setting up python3-setuptools (20.7.0-1) ...
Setting up python3-wheel (0.29.0-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
Collecting transifex-client
  Downloading https://files.pythonhosted.org/packages/11/c0/c54fd912be3820df880a89e0ce4d393c73a16967fe61f76c7fea53b4ad18/transifex-client-0.14.3.tar.gz (211kB)
Collecting urllib3<2.0.0,>=1.24.2 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/5f/64/43575537846896abac0b15c3e5ac678d787a4021e906703f1766bfb8ea11/urllib3-1.26.6-py2.py3-none-any.whl (138kB)
Requirement already satisfied (use --upgrade to upgrade): six<2.0.0 in /usr/lib/python3/dist-packages (from transifex-client)
Collecting requests<3.0.0,>=2.19.1 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/92/96/144f70b972a9c0eabbd4391ef93ccd49d0f2747f4f6a2a2738e99e5adc65/requests-2.26.0-py2.py3-none-any.whl (62kB)
Collecting python-slugify<5.0.0 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/9f/42/e336f96a8b6007428df772d0d159b8eee9b2f1811593a4931150660402c0/python-slugify-4.0.1.tar.gz
Collecting gitpython<4.0.0 (from transifex-client)
  Downloading https://files.pythonhosted.org/packages/b7/f7/1687fc522bc7a7f7cdacd3854ac749bcadca44c257897843de60d1fad8fe/GitPython-3.1.19-py3-none-any.whl (177kB)
Collecting idna<4,>=2.5; python_version >= "3" (from requests<3.0.0,>=2.19.1->transifex-client)
  Downloading https://files.pythonhosted.org/packages/d7/77/ff688d1504cdc4db2a938e2b7b9adee5dd52e34efbd2431051efc9984de9/idna-3.2-py3-none-any.whl (59kB)
Collecting charset-normalizer~=2.0.0; python_version >= "3" (from requests<3.0.0,>=2.19.1->transifex-client)
  Downloading https://files.pythonhosted.org/packages/c4/1d/e6ce112f7237fc746e632e1cbdc24890cad95505c6cd4b711f4fd17f4735/charset_normalizer-2.0.3-py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests<3.0.0,>=2.19.1->transifex-client)
  Downloading https://files.pythonhosted.org/packages/05/1b/0a0dece0e8aa492a6ec9e4ad2fe366b511558cdc73fd3abc82ba7348e875/certifi-2021.5.30-py2.py3-none-any.whl (145kB)
Collecting text-unidecode>=1.3 (from python-slugify<5.0.0->transifex-client)
  Downloading https://files.pythonhosted.org/packages/a6/a5/c0b6468d3824fe3fde30dbb5e1f687b291608f9473681bbf7dabbf5a87d7/text_unidecode-1.3-py2.py3-none-any.whl (78kB)
Collecting typing-extensions>=3.7.4.3; python_version < "3.10" (from gitpython<4.0.0->transifex-client)
  Downloading https://files.pythonhosted.org/packages/2e/35/6c4fff5ab443b57116cb1aad46421fb719bed2825664e8fe77d66d99bcbc/typing_extensions-3.10.0.0-py3-none-any.whl
Collecting gitdb<5,>=4.0.1 (from gitpython<4.0.0->transifex-client)
  Downloading https://files.pythonhosted.org/packages/ea/e8/f414d1a4f0bbc668ed441f74f44c116d9816833a48bf81d22b697090dba8/gitdb-4.0.7-py3-none-any.whl (63kB)
Collecting smmap<5,>=3.0.1 (from gitdb<5,>=4.0.1->gitpython<4.0.0->transifex-client)
  Downloading https://files.pythonhosted.org/packages/68/ee/d540eb5e5996eb81c26ceffac6ee49041d473bc5125f2aa995cf51ec1cf1/smmap-4.0.0-py2.py3-none-any.whl
Building wheels for collected packages: transifex-client, python-slugify
  Running setup.py bdist_wheel for transifex-client: started
  Running setup.py bdist_wheel for transifex-client: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/55/7f/84/346a24850d08f7f4926cb2bcae1f04da7b35f7cb2735f5bdfa
  Running setup.py bdist_wheel for python-slugify: started
  Running setup.py bdist_wheel for python-slugify: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/67/b8/ba/041548f30a6fc058c9b3f79a5b7b6aea925a15dd1e5c4992a4
Successfully built transifex-client python-slugify
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, text-unidecode, python-slugify, typing-extensions, smmap, gitdb, gitpython, transifex-client
  Found existing installation: urllib3 1.13.1
    Not uninstalling urllib3 at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: requests 2.9.1
    Not uninstalling requests at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed certifi-2021.5.30 charset-normalizer-2.0.3 gitdb-4.0.7 gitpython-3.1.19 idna-3.2 python-slugify-4.0.1 requests-2.26.0 smmap-4.0.0 text-unidecode-1.3 transifex-client-0.14.3 typing-extensions-3.10.0.0 urllib3-1.26.6
You are using pip version 8.1.1, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already up-to-date: transifex-client in /usr/local/lib/python3.5/dist-packages
Collecting six<2.0.0 (from transifex-client)
  Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Requirement already up-to-date: gitpython<4.0.0 in /usr/local/lib/python3.5/dist-packages (from transifex-client)
Requirement already up-to-date: requests<3.0.0,>=2.19.1 in /usr/local/lib/python3.5/dist-packages (from transifex-client)
Requirement already up-to-date: urllib3<2.0.0,>=1.24.2 in /usr/local/lib/python3.5/dist-packages (from transifex-client)
Requirement already up-to-date: python-slugify<5.0.0 in /usr/local/lib/python3.5/dist-packages (from transifex-client)
Requirement already up-to-date: gitdb<5,>=4.0.1 in /usr/local/lib/python3.5/dist-packages (from gitpython<4.0.0->transifex-client)
Requirement already up-to-date: typing-extensions>=3.7.4.3; python_version < "3.10" in /usr/local/lib/python3.5/dist-packages (from gitpython<4.0.0->transifex-client)
Requirement already up-to-date: idna<4,>=2.5; python_version >= "3" in /usr/local/lib/python3.5/dist-packages (from requests<3.0.0,>=2.19.1->transifex-client)
Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests<3.0.0,>=2.19.1->transifex-client)
Requirement already up-to-date: charset-normalizer~=2.0.0; python_version >= "3" in /usr/local/lib/python3.5/dist-packages (from requests<3.0.0,>=2.19.1->transifex-client)
Requirement already up-to-date: text-unidecode>=1.3 in /usr/local/lib/python3.5/dist-packages (from python-slugify<5.0.0->transifex-client)
Requirement already up-to-date: smmap<5,>=3.0.1 in /usr/local/lib/python3.5/dist-packages (from gitdb<5,>=4.0.1->gitpython<4.0.0->transifex-client)
Installing collected packages: six
  Found existing installation: six 1.10.0
    Not uninstalling six at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed six-1.16.0
You are using pip version 8.1.1, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
  File "/usr/local/bin/tx", line 7, in <module>
    from txclib.cmdline import main
  File "/usr/local/lib/python3.5/dist-packages/txclib/cmdline.py", line 7, in <module>
    from txclib import utils, web
  File "/usr/local/lib/python3.5/dist-packages/txclib/utils.py", line 6, in <module>
    import git
  File "/usr/local/lib/python3.5/dist-packages/git/__init__.py", line 8, in <module>
    from git.exc import *                       # @NoMove @IgnorePep8
  File "/usr/local/lib/python3.5/dist-packages/git/exc.py", line 10, in <module>
    from git.compat import safe_decode
  File "/usr/local/lib/python3.5/dist-packages/git/compat.py", line 37
    is_win: bool = (os.name == 'nt')
          ^
SyntaxError: invalid syntax

What should I try next?

transifexGithub commented 3 years ago

Thank for your quick reply, Could you confirm which python versions you have installed ?, If you don't have python 2, could you install it ?

Best Regards

luboganev commented 3 years ago

I have ran this:

python -V

And the output is:

Python 2.7.12
transifexGithub commented 3 years ago

Hello,

I apologize for the delay, Could you please try the following approach which I have tested in my docker container:

Make a folder for our dockerfile

mkdir /tmp/python_transifex_client_docker
cd /tmp/python_transifex_client_docker

​ Create our dockerfile

cat > Dockerfile << EOF
FROM python
RUN pip install transifex-client
ENTRYPOINT ["tx", "init"]
EOF

Build the docker image and tag it docker build --tag transifex-client . ​ Exit the folder and delete it cd - rm -r /tmp/python_transifex_client_docker ​ Make an alias for running the docker image as a command alias tx='docker run --rm -it transifex-client' ​ Test it tx init

image

Give it a try and let me know how it goes :)

luboganev commented 3 years ago

Hi,

No worries, Mondays are always busy.

Thank you very much for trying this out, but maybe I should have been more specific.

I am trying to run this in Bitrise CI, which is our CI solution https://app.bitrise.io/

I don't get to decide how to setup Docker there and don't have access to the raw hardware. I can just add steps to the workflow through the Web UI. The step I am doing is executing a shell script on the machine as one of the steps in the flow. I execute this shell script already inside the docker image.

I'll try to setup the transifex-client with another method Bitrise offers, cause seems like it is not possible through standard shell script. I guess it's not a Transifex issue, but something on Bitrise side, since all your examples seem to work on your machine. I'll contact Bitrise and try to figure it out with them. Thank you again for the testing and support.