Poetry installed but `poetry: command not found` on Google Colab - google-colaboratory

I was following this github, where it gave me the following instructions:
Project was built with poetry (https://python-poetry.org/), so it is
recommended to get poetry first to install all the dependencies. After
poetry installation you can simply clone this repo, navigate to the
root directory, and run:
From the website I ran this command:
!curl -sSL https://install.python-poetry.org | python3 -
After executing this I get the following prompt:
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
/root/.local/bin
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (1.1.15)
Installing Poetry (1.1.15): Creating environment
Installing Poetry (1.1.15): Installing Poetry
Installing Poetry (1.1.15): Creating script
Installing Poetry (1.1.15): Done
Poetry (1.1.15) is installed now. Great!
To get started you need Poetry's bin directory (/root/.local/bin) in your `PATH`
environment variable.
Add `export PATH="/root/.local/bin:$PATH"` to your shell configuration file.
Alternatively, you can call Poetry explicitly with `/root/.local/bin/poetry`.
You can test that everything is set up by executing:
`poetry --version`
Thus, I ran the following command next:
!export PATH="/root/.local/bin:$PATH"
This gave no issues. But, after running poetry --version. It gave me the following error prompt:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-25-4666e7fa95ae> in <module>
----> 1 poetry --version
NameError: name 'poetry' is not defined
Can anyone help how to run this? I am new to colab. I got a similar question here. But, it is not working in my case.
Using something like this: !/root/.local/bin/poetry --version is working, but how do I add that $PATH in the shell configuration file in colab, so I don't have to call it by using the path before it every time?

Related

How to install dependencies to Odoo's built-in Python?

I installed Odoo and it came with built-in Python. I want to install an auto_update plugin, which needs paramiko installed with pip to Python.
This means my problem is to install, with some pip, an add-on paramiko to Python installation of Odoo instead of default Python.
This topic - https://www.odoo.com/es_ES/forum/ayuda-1/how-to-install-an-external-python-dependency-in-windows-platform-of-odoo-170983 - gives link to https://www.cybrosys.com/blog/how-to-install-odoo-in-windows#python-dependency-odoo-windows; but first, I don't want to change my python default PATH into another one, and second, trying in virtual machine, that did not work - easy_install is not recognized as command.
I tried to run pip installation in PowerShell, which is in Odoo folder of python; I went to C:\Program Files\Odoo 16..\python\Scripts with PowerShell and ran "./pip" or "./pip3" - they gave me an error "Fatal error in launcher: Unable to create process using '"c:\odoobuild\winpy64\python-3.7.7.amd64\python.exe" "C:\Program Files\Odoo 16.0.20230110\python\Scripts\pip3.exe" ': El sistema no puede encontrar el archivo especificado.", which means it tried to use python from Odoo folder they used to build it, but my python is in Program Files with Odoo. How to run this specific pip to install addons to Odoo?
Edit:
Dealing with multiple Python versions and PIP? - this is Python question about the same topic; it gives examples about using different versions of python. When I tried something in it - running the same instance of Python with -m pip, which I wanted to upgrade, python of Odoo updates the deps of it's built-in postgresql python instead.

The package version does not appear to be updating when importing locally with pipenv, even when in editable (developer) mode

I have written a small python package on my machine and made it importable with distutils. My setup.py has version='0.0.3'.
In a separate folder, I have a Pipenv environment and I install the package with the command:
pipenv install -e ~/path/to/my_pack
I then get the version with the commands:
pipenv run python
>> import pkg_resources # part of setuptools
>> version = pkg_resources.require("my_pack")[0].version
>> print(version)
0.0.3
>> exit()
Next, I change the version in setup.py to 0.0.4 and run the above Python again, but it still says 0.0.3. Why is this? How can I fix it?
If I add functions inside the my_pack code base, I can see them when I restart Python, but the version never changes.

What is the setup.py file in github repository used for?

How can I run the code in this repository without following their steps, I want to run the main.py file, from the Demo, directly.
What are the setup.py and install.sh files used for?
setup.py is the canonical name for the installer of a Python package. For example, when you run pip install x, pip runs the setup.py of the package you installed. In this case, install.sh is just a shortcut for running setup.py.
There's no way to use a package without installing it, since it won't have what it needs to operate properly.

No module named install

Yes you read it right!
I am trying to install pygame, so I downloaded the whl file and copied it to my project's folder, in the command prompt I navigated to the folder and entered
python -m install --user pygame-1.9.2-cp35-cp35m-win32.whl
Now if you can help me here that would be really appreciated, why is the error so rare that I couldn't find it anywhere.
Python doesn't have a module called "install". The module you're looking for is probably pip.
Just type in the command prompt:
python -m pip install --user pygame-1.9.2-cp35-cp35m-win32.whl
And pygame should start being installed.

install Pig package

I have to install Hadoop before installing Pig package.
Hadoop requires a working Java 1.6.x installation.So I tried to run the following command to install sun-java6-jdk:
$ sudo apt-get install sun-java6-jdk
but I have problems and I obtain this error when trying to install any other package
Traceback (most recent call last): File
"/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 968, in
simulate
trans.unauthenticated = self._simulate_helper(trans) File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 1092, in
_simulate_helper
return depends, self._cache.required_download, \ File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 235, in
required_download
pm.get_archives(fetcher, self._list, self._records) SystemError: E:I wasn't able to locate a file for the sun-java6-bin package. This
might mean you need to manually fix this package.
How to solve this problem?
Probably means that you have not (correctly) installed Hadoop, which is required for running Pig.
You can either install on a single node for testing / development and then deploy on a cluster if you have access to one.
Guide to install Hadoop (either single or cluster):
http://hadoop.apache.org/common/docs/stable/single_node_setup.html
http://hadoop.apache.org/common/docs/stable/cluster_setup.html