On my Ubuntu 18.04.1 LTS I have installed pipenv package using pip package manager. Package is accessible from ssh login bash.
$ pipenv --version
will print out following output:
pipenv, version 2018.10.13
What want:
I need to run $ pipenv --version command using absolute path. So This is how it should look like:
$ /absolute/path/to/pipenv --version
However so far it looks like it does not work by this way.
What I tried:
$ pip show pipenv
Name: pipenv
Version: 2018.10.13
Location: /user/.local/lib/python2.7/site-packages
Requires: enum34, virtualenv, typing, certifi, virtualenv-clone, pip, setuptools
...
I copied location from output above, and I tried these, but still does not work:
$ /user/.local/lib/python2.7/site-packages/pipenv --version
$ /user/.local/lib/python2.7/site-packages/pipenv/pipenv --version
I also tried:
which pipenv - outputs empty string
Recapping the comments, if pipenv command is available, you can:
run command -v pipenv or which pipenv if pipenv is an executable in PATH
run type pipenv if pipenv is an alias or a function
If the command is not available, you can extract the info about the executable from the package metadata: run
$ pip show -f pipenv
to list the files belonging to the pipenv package (If the output is empty, it means that pipenv is not installed for the Python version pip refers to). Among other things, it will print you the package location, similar to
Location: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
and with other files, the executable:
../../../bin/pipenv
This is the path relative to the Location above - the resolved path leads you to the executable file.
Related
While installing LabelImg in M1 Mac using below command
pip install pyqt5 lxml
This is the error I got
ERROR: pyqt5 from https://files.pythonhosted.org/packages/7c/5b/e760ec4f868cb77cee45b4554bf15d3fe6972176e89c4e3faac941213694/PyQt5-5.14.0.tar.gz#sha256=0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72 has a pyproject.toml file that does not comply with PEP 518: 'build-system.requires' contains an invalid requirement: 'sip >=5.0.1 <6'
How to install lableImg annotation tool in M1 Mac?
I got it to work by using the following commands
brew install pyqt#5
pip install labelimg
And that's it, it just works
You just need to type labelimg in the Terminal and the app will start running
I don't know why they don't tell you this in the installation guide
Alrighty!
On MacOS Monterey, none of the other solutions posted here solved this problem for me. However, I managed to easily solve the issue, without a virtual environment or too much fiddling about like so:
Firstly, you have to download all labelImg packages from this link:
https://github.com/tzutalin/labelImg#macos
(You can download it as a .zip file or clone it)
Unzip and then in your terminal cd into whatever directory you downloaded the above files to.
Then run the following commands in order:
pyrcc5 -o libs/resources.py resources.qrc
Then,
pip3 install lxml
Finally,
python3 labelImg.py
It should run without an issue now.
You can go one of two ways:
Using brew:
You can use homebrew to install the dependencies - like qt and libxml2. This will let your package manager handle everything and generally should solve the problem with the . Then you can run
python3 labelimg.py
Using Virtual Environments:
This is the more recommended way to go about in such cases. You can use conda, pipenv or venv to create a virtual environment which is isolated from your system python installation. Then you can try to install it as explained in the README.rst in the root of the repository:
brew install python3
pip3 install pipenv
pipenv run pip install pyqt5==5.12.1 lxml
pipenv run make qt5py3
pipenv run python3 labelImg.py
[Optional] rm -rf build dist; python setup.py py2app -A;mv "dist/labelImg.app" /Applications
You can try the two methods and and get back with the errors if there are any.
This is my note.
I just succeed on my Mac M1 Chip
CHECK THIS OUT!
Installation of labelimg on mac m1 chip
my first reference
my second reference
First, you must use terminal with rosetta version
Then, you already have python3
Then...
[Done]
# check where python3 is
$ where python3
# create env
$ /usr/bin/python3 -m venv env
# check env is
$ where env
# activate env list
$ source env/bin/activate
# updated to the newest
$ pip install --upgrade pip
# installation of PyQt5
$ pip install PyQt5
# start to run labelImg.py
$ cd Documents/repos/labelImg
$ pip3 install pyqt5 lxml
$ make qt5py3
# [run ok!!]
$ python3 labelImg.py
Using Conda
Create a virtual environment in conda and activate it
conda create -n venv
conda activate venv
Install pyqt using conda
conda install pyqt
Install lxml using pip
pip install lxml
Change directory to the downloaded/cloned labelImg folder
cd path/to/labelImg/folder/
Make qt5py3
make qt5py3
Run LabelImg
python labelImg.py
I am Mac User (Big Sur 11.2.3) and I changed the Terminal from bash to zsh. I had a really hard time to install pip and set up the Environment Path and when I came to the point to install robotframework and all the paraphernalia I get a command not found on zsh.
Has someone sorted this out?
~ % pip install robotframework
zsh: command not found: pip
Are you using Python3 (which is installed on MacOS BigSur) to install roboframework?
Check path: which pyhton3
PIP-version: python3 -m pip --version
You can change shells zhs/bash/... for you install session, if that helps (to follow the roboFW install-guides).
zsh: command not found: pip means that the dir containing pip is not in your $path. There's probably something you forgot to copy from your .bashrc file to your .zshrc file. If you're using PyEnv to manage your Python versions (and you should!), then this is the line in question:
eval "$(pyenv init -)"
I'm curious whether Julia supports the same workflow as Python + virtual environments.
In Python I can do the following from the terminal:
$ python -m venv venv
$ source venv/bin/activate
(venv) $ pip install myFavPackage
(venv) $ python src/myFavScript.py
Julia can use virtual environments through its REPL like so:
(#v1.5) pkg> activate .
(myFavProject) pkg> add myFavPackage
julia> include("src/myFavScript.jl")
But if I run the first two lines (which adds all dependencies to the Project.toml and Manifest.toml files) and then jump out to the terminal and run
$ julia src/myFavScript.jl
Then it doesn't recognise the package I installed:
ERROR: LoadError: ArgumentError: Package myFavPackage not found in current path:
- Run `import Pkg; Pkg.add("myFavPackage")` to install the myFavPackage package.
Does this mean that I have to install my packages globally to run Julia scripts from the terminal? And if not, how can I force the terminal to use the local dependencies?
You can use the --project flag, i.e.
$ julia --project=path/to/project src/myFavScript.jl
If you are in the correct folder you can just omit the path, i.e.
$ julia --project src/myFavScript.jl
Finally, if you want this behavor by default, you can set the the JULIA_PROJECT environment variable to #., which is equivalent to always starting Julia with --project.
According to the venv documentation in Python3:
Changed in version 3.5: The use of venv is now recommended for creating virtual environments.
With Python3.6 installed in my Ubuntu 16, I tried to create a Python project with command python3 -m venv project, but got the following error:
Error: Command '['/home/me/git/project/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
Question: Why could this have happened? and how to resolve?
sudo apt-get install -y python3-pip is worth a try, based on https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-16-04-server
If that fails, what does python3 --version print?
I am not able to link Jupyter kernels to their parent Conda environments. After creating a new kernel linked to Conda environment, I'm getting a different version of Python and its dependencies inside Jupyter lab.
Here are the steps I followed:
Created a conda environment using:
conda create -n nlp python=3.6
conda activate nlp
(nlp) ➜ ~ python --version
Python 3.6.9 :: Anaconda, Inc.
(nlp) ➜ ~ which python
/anaconda3/envs/nlp/bin/python
Inside the environment I created a Jupyter kernel with:
(nlp) ➜ ~ python -m ipykernel install --user --name=nlp
Installed kernelspec nlp in /Users//Library/Jupyter/kernels/nlp
Investigating the created json file for the kernel:
(nlp) ➜ ~ cat /Users/<username>/Library/Jupyter/kernels/nlp/kernel.json
{
"argv": [
"/anaconda3/envs/nlp/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "nlp",
"language": "python"
}%
It seems to be pointing to the environment version of Python
But when I start Jupyter Lab and select the nlp kernel, I get a different version of Python and some dependencies are missing
!python --version
Python 3.5.6 :: Anaconda, Inc.
!which python
/anaconda3/bin/python
Could you please try the following steps:
conda activate nlp
conda install ipykernel
ipython kernel install --name nlp --user
After these steps please try changing the kernel again in jupyter lab to "nlp".
Thanks.
this behavior is actually normal in Jupyter lab.
If you run
import sys
print(sys.version)
!python --version
in a notebook, the print statement will give you the Python version of the conda env, while the second will give you the Python version of your base env.
The easiest workaround for this is to simply pip install jupyterlab in your conda env and then run jupyter lab in your conda env. Then, there will not be a mismatch in Python versions between the new "base" env and the conda env which will help clear up any DLL problems.
It's probably not best practice, but you do what you gotta do when working with legacy code, ig.
Can you try this :
# in base env
conda install nb_conda_kernels
conda activate nlp
conda install ipykernel
conda install ipywidgets
# install kernelspec
python -m ipykernel install --user --name nlp --display-name "nlp env"
When you run jupyter notebook, you will see 2 nlp kernels. Use the one with "Python [conda:env:nlp]"