Feb-10-2020, 09:45 PM
I am using poetry to manage my project. When I am in my dev environment and I do a poetry install my project is executable without issue. When I do a poetry build and copy the wheel file to another machine, pip install wheel_file installs everything but it isn't executable. I am thinking maybe it is something with my setup.py file but I can't figure out my error. Any help is appreciated! Thank you.
[/output]
Output:=========================
Dev machine
==============================
mike@LWIN-018987 09:03:01 0 :~/python/pynet[master] $ ls
build devices.db dist docs poetry.lock pyproject.toml README.rst setup.py src tests
mike@LWIN-018987 09:04:43 0 :~/python/pynet[master] $ tree src/
src/
├── pynet
│ ├── cli.py
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── cli.cpython-38.pyc
│ │ ├── __init__.cpython-38.pyc
│ │ ├── pynet.cpython-38.pyc
│ │ └── sqlitenet.cpython-38.pyc
│ └── sqlitenet.py
└── pynet.egg-info
├── dependency_links.txt
├── entry_points.txt
├── PKG-INFO
├── SOURCES.txt
└── top_level.txt
3 directories, 12 files
mike@LWIN-018987 09:04:49 0 :~/python/pynet[master] $
----------
Here is what setup.py looks like
------------------------------------------
mike@LWIN-018987 09:02:58 0 :~/python/pynet[master] $ cat setup.py
from setuptools import setup, find_packages
with open('README.rst', encoding='UTF-8') as f:
README = f.read()
setup(
name='pynet',
version='0.5.0',
description='CLI tool for managing network switches',
long_description=README,
author='Michael',
author_email='[email protected]',
packages=find_packages(where="src"),
package_dir={"":"src"},
python_requires='>=3.8',
entry_points={
'console_scripts': [
'pynet=pynet.cli:main'
]
}
)
mike@LWIN-018987 09:03:01 0 :~/python/pynet[master] $
------------------------------------------------------------
mike@LWIN-018987 08:51:34 0 :~/python $ cd pynet/
lmike@LWIN-018987 08:51:37 0 :~/python/pynet[master] $ ls
build devices.db dist docs poetry.lock pyproject.toml README.rst setup.py src tests
mike@LWIN-018987 08:51:37 0 :~/python/pynet[master] $ poetry shell
Spawning shell within /home/mike/.cache/pypoetry/virtualenvs/pynet-1GMG6Wb--py3.8
. /home/mike/.cache/pypoetry/virtualenvs/pynet-1GMG6Wb--py3.8/bin/activate
mike@LWIN-018987 08:51:47 0 :~/python/pynet[master] $ . /home/mike/.cache/pypoetry/virtualenvs/pynet-1GMG6Wb--py3.8/bin/activate
=====================================
Here the command "pynet" is executable and on path
=================================================
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:51:48 0 :~/python/pynet[master] $ pynet
Usage: pynet [OPTIONS] COMMAND [ARGS]...
Pynet is a cli tool for managing network devices. Command is a required
argument. Use --help to get a list of each command's options.
Example: pynet more-help --help
Options:
--help Show this message and exit.
Commands:
add-new-device Add a single device to the database
backup-database Backs up the current database
create-database Creates a new database
delete-device Delete a single device from the database
find-device Find a device in the database
get-device Get all fields for a specfic device record
import-devices Imports a csv of devices to the sqlite database...
more-help Various help options for usage information
run-adhoc-cmd Run a single command against a device
run-adhoc-cmds Run a single command against multiple device
update-all-devices Update stored information for all devices
update-device-info Updates info for a specific device
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:51:50 0 :~/python/pynet[master] $ pip freeze
appdirs==1.4.3
astroid==2.3.3
attrs==19.3.0
autopep8==1.4.4
bcrypt==3.1.7
black==19.10b0
cffi==1.13.2
Click==7.0
cryptography==2.8
future==0.18.2
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1
netmiko==2.4.2
paramiko==2.7.1
pathspec==0.7.0
pycodestyle==2.5.0
pycparser==2.19
pylint==2.4.4
PyNaCl==1.3.0
-e git+https://github.com/mp/pynet.git@9bf6b8b97b9a500eaed6da606226f5431c8dd659#egg=pynet
pyserial==3.4
regex==2020.1.8
scp==0.13.2
six==1.13.0
termcolor==1.1.0
textfsm==1.1.0
toml==0.10.0
typed-ast==1.4.1
wrapt==1.11.2
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:52:08 0 :~/python/pynet[master] $ poetry install
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing wheel (0.33.6)
- Installing pynet (0.5.0)
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:52:18 0 :~/python/pynet[master] $ rm -rf dist/*
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:52:26 0 :~/python/pynet[master] $ poetry build
Building pynet (0.5.0)
- Building sdist
- Built pynet-0.5.0.tar.gz
- Building wheel
- Built pynet-0.5.0-py3-none-any.whl
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:52:31 0 :~/python/pynet[master] $ scp dist/pynet-0.5.0-py3-none-any.whl mike@app:~
pynet-0.5.0-py3-none-any.whl 100% 6450 608.7KB/s 00:00
(pynet-1GMG6Wb--py3.8) mike@LWIN-018987 08:52:54 0 :~/python/pynet[master] $ ssh mike@app
======================================
Another linux machine with a clean venv
================================================
Linux app1. 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64
mike@app1 08:53:02 0 :~ $ cd python
mike@app1 08:53:07 0 :~/python $ ls ~
activestaff-notinJC.txt bin build devices.csv new.csv pynet-0.5.0-py3-none-any.whl python repomigrate studentimportdb-0.1.0-py3-none-any.whl stuff venvs versions1.txt versions.txt
mike@app1 08:53:09 0 :~/python $ rm -rf pynet
mike@app1 08:53:25 0 :~/python $ mkdir pynet
mike@app1 08:53:27 0 :~/python $ cd pynet/
mike@app1 08:53:29 0 :~/python/pynet $ python --version
Python 3.8.0
mike@app1 08:53:35 0 :~/python/pynet $ python -m venv pynet-env
mike@app1 08:54:09 0 :~/python/pynet $ ls
pynet-env
mike@app1 08:54:11 0 :~/python/pynet $ source pynet-env/bin/activate
(pynet-env) mike@app1 08:54:19 0 :~/python/pynet $ pip install ~/pynet-0.5.0-py3-none-any.whl
Processing /home/mike/pynet-0.5.0-py3-none-any.whl
Collecting netmiko<3.0,>=2.4 (from pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/26/05/dbe9c97c39f126e7b8dc70cf897dcad557dbd579703f2e3acfd3606d0cee/netmiko-2.4.2-py2.py3-none-any.whl
Collecting termcolor<2.0,>=1.1 (from pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting click<8.0,>=7.0 (from pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting textfsm (from netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/bd/27/0b149b6da3e47cc8daebace6920093114392171a8f5c24f1f2ad9a9e9c4d/textfsm-1.1.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=38.4.0 in ./pynet-env/lib/python3.8/site-packages (from netmiko<3.0,>=2.4->pynet==0.5.0) (41.2.0)
Collecting paramiko>=2.4.3 (from netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/06/1e/1e08baaaf6c3d3df1459fd85f0e7d2d6aa916f33958f151ee1ecc9800971/paramiko-2.7.1-py2.py3-none-any.whl
Collecting pyserial (from netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl
Collecting scp>=0.13.2 (from netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/4d/7a/3d76dc5ad8deea79642f50a572e1c057cb27e8b427f83781a2c05ce4e5b6/scp-0.13.2-py2.py3-none-any.whl
Collecting future (from textfsm->netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
Collecting six (from textfsm->netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting pynacl>=1.0.1 (from paramiko>=2.4.3->netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/27/15/2cd0a203f318c2240b42cd9dd13c931ddd61067809fee3479f44f086103e/PyNaCl-1.3.0-cp34-abi3-manylinux1_x86_64.whl
Collecting bcrypt>=3.1.3 (from paramiko>=2.4.3->netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/8b/1d/82826443777dd4a624e38a08957b975e75df859b381ae302cfd7a30783ed/bcrypt-3.1.7-cp34-abi3-manylinux1_x86_64.whl
Collecting cryptography>=2.5 (from paramiko>=2.4.3->netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/ca/9a/7cece52c46546e214e10811b36b2da52ce1ea7fa203203a629b8dfadad53/cryptography-2.8-cp34-abi3-manylinux2010_x86_64.whl
Collecting cffi>=1.4.1 (from pynacl>=1.0.1->paramiko>=2.4.3->netmiko<3.0,>=2.4->pynet==0.5.0)
Downloading https://files.pythonhosted.org/packages/49/de/1ab40dd857172da4accad610c25badfdfc23ec7e1bbcc6f9212cfcb3419d/cffi-1.14.0-cp38-cp38-manylinux1_x86_64.whl (409kB)
|████████████████████████████████| 409kB 4.3MB/s
Collecting pycparser (from cffi>=1.4.1->pynacl>=1.0.1->paramiko>=2.4.3->netmiko<3.0,>=2.4->pynet==0.5.0)
Using cached https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz
Installing collected packages: future, six, textfsm, pycparser, cffi, pynacl, bcrypt, cryptography, paramiko, pyserial, scp, netmiko, termcolor, click, pynet
Running setup.py install for future ... done
Running setup.py install for pycparser ... done
Running setup.py install for termcolor ... done
Successfully installed bcrypt-3.1.7 cffi-1.14.0 click-7.0 cryptography-2.8 future-0.18.2 netmiko-2.4.2 paramiko-2.7.1 pycparser-2.19 pynacl-1.3.0 pynet-0.5.0 pyserial-3.4 scp-0.13.2 six-1.14.0 termcolor-1.1.0 textfsm-1.1.0
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(pynet-env) mike@app1 08:54:53 0 :~/python/pynet $ pynet
-bash: pynet: command not found
(pynet-env) mike@app1 08:54:59 0 :~/python/pynet $ python
Python 3.8.0 (default, Dec 20 2019, 14:54:35)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynet
>>> pynet.__file__
'/home/mike/python/pynet/pynet-env/lib/python3.8/site-packages/pynet/__init__.py'
>>> exit()
(pynet-env) mike@app1 08:55:26 0 :~/python/pynet $ python /home/mike/python/pynet/pynet-env/lib/python3.8/site-packages/pynet/cli.py
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
Pynet is a cli tool for managing network devices. Command is a required
argument. Use --help to get a list of each command's options.
Example: pynet more-help --help
Options:
--help Show this message and exit.
Commands:
add-new-device Add a single device to the database
backup-database Backs up the current database
create-database Creates a new database
delete-device Delete a single device from the database
find-device Find a device in the database
get-device Get all fields for a specfic device record
import-devices Imports a csv of devices to the sqlite database...
more-help Various help options for usage information
run-adhoc-cmd Run a single command against a device
run-adhoc-cmds Run a single command against multiple device
update-all-devices Update stored information for all devices
update-device-info Updates info for a specific device
=======================================================
Here after installing in venv pynet is not executable
========================================================
(pynet-env) mike@app1 08:55:39 0 :~/python/pynet $ pynet
-bash: pynet: command not found
(pynet-env) mike@app1 08:55:42 0 :~/python/pynet $[output][output]
[/output][/output]