Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/adding pipenv #12

Closed

Conversation

elreydetoda
Copy link
Collaborator

@elreydetoda elreydetoda commented Jul 18, 2022

Added the Pipenv files, and it seems like the packages updated to their latest version but I didn't have any errors when I ran things (seemed like almost all were just minor version updates (pyyaml bumped to 6.0 vs 5.x).

I also modified the Dockerfile and the documentation to reflect the workflow for using pipenv. Right now we don't have development dependencies, don't know what your preference is, but in the future I'm sure it'll be important.

Let me know if you want any modifications 🙂

closes #11

@kbondarev
Copy link
Collaborator

kbondarev commented Jul 18, 2022

I will review, test, and merge this and the other PR with the GH action modifications tomorrow night (EDT)

@kbondarev
Copy link
Collaborator

Sorry for the late response - it's a busy week.

So..... I followed the instructions in the README and I get this error when running pipenv install -d:

$ pipenv install -d
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
Creating a virtualenv for this project...
Pipfile: /home/kiro/Code/JupiterBroadcasting/show-scraper/Pipfile
Using /usr/bin/python3 (3.10.4) to create virtualenv...
⠇ Creating virtual environment...created virtual environment CPython3.10.4.final.0-64 in 210ms
  creator CPython3Posix(dest=/home/kiro/.local/share/virtualenvs/show-scraper-Nm7Q6D-6, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/kiro/.local/share/virtualenv)
    added seed packages: pip==22.1.2, setuptools==62.6.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment! 
Traceback (most recent call last):
  File "/home/kiro/.local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/cli/options.py", line 56, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/cli/command.py", line 222, in install
    do_install(
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/core.py", line 1964, in do_install
    ensure_project(
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/core.py", line 555, in ensure_project
    ensure_virtualenv(
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/core.py", line 488, in ensure_virtualenv
    do_create_virtualenv(
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/core.py", line 1015, in do_create_virtualenv
    project._environment = Environment(
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/environment.py", line 72, in __init__
    self._base_paths = self.get_paths()
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/environment.py", line 394, in get_paths
    c = subprocess_run(command)
  File "/home/kiro/.local/lib/python3.10/site-packages/pipenv/utils/processes.py", line 75, in subprocess_run
    return subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/kiro/.local/share/virtualenvs/show-scraper-Nm7Q6D-6/bin/python'

Some more info that might be useful:

$ tree /home/kiro/.local/share/virtualenvs/
/home/kiro/.local/share/virtualenvs/
└── show-scraper-Nm7Q6D-6
    ├── lib
    │   └── python3.10
    ├── local
    │   ├── bin
    │   │   ├── activate
    │   │   ├── activate.csh
    │   │   ├── activate.fish
    │   │   ├── activate.nu
    │   │   ├── activate.ps1
    │   │   ├── activate_this.py
    │   │   ├── deactivate.nu
    │   │   ├── pip
    │   │   ├── pip3
    │   │   ├── pip-3.10
    │   │   ├── pip3.10
    │   │   ├── python -> /usr/bin/python3
    │   │   ├── python3 -> python
    │   │   ├── python3.10 -> python
    │   │   ├── wheel
    │   │   ├── wheel3
    │   │   ├── wheel-3.10
    │   │   └── wheel3.10
...
...
...

Looks like the binaries are under the /home/kiro/.local/share/virtualenvs/show-scraper-Nm7Q6D-6/local dir, but for some reason it looks for them under /home/kiro/.local/share/virtualenvs/show-scraper-Nm7Q6D-6/bin

$ python --version
Python 3.10.4
pipenv --version
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/local/lib/python3.10/dist-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
pipenv, version 2022.7.4

Any idea what's going on?

@elreydetoda
Copy link
Collaborator Author

No problem, I feel you on that 😅

That's very odd...I've installed pipenv env on windows and it's worked for me... 🤔

So...the only think that I can think of (that's different) is that I think you've installed python-is-python3 ( which is why you can do python -V and it's python3) maybe try something like this?

$ pipenv install -d --python python3

Also, can you run pip -V, pip3 -V, & python3 -V?

@kbondarev
Copy link
Collaborator

So...the only think that I can think of (that's different) is that I think you've installed python-is-python3 ( which is why you can do python -V and it's python3) maybe try something like this?

Don't remember installing anything like that. I'm on Ubuntu 22.04, isn't python3 been default for a few years now?


Same error with the --python python3

> pip -V
pip 22.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
> pip3 -V
pip 22.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
> python3 -V
Python 3.10.4

@elreydetoda
Copy link
Collaborator Author

Ya, but it normally shows as a this for me when I run python:

$ python
Command 'python' not found, did you mean:
  command 'python3' from deb python3
  command 'python' from deb python-is-python3

Your pip output is very interesting... Normally /usr/local/ is used for installing user packages, which the user want's to use and possibly override the system's binaries... 🤔

When I run those commands I get this:

$ pip -V
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
$ pip3 -V
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
$  python3 -V
Python 3.10.4

which is what I was expecting from your system...

Can you run the following command so we can compare yours to mine:

# for i in pip python pip3 python3 ; do command -v "${i}" ; done
/usr/bin/pip
/usr/bin/pip3
/usr/bin/python3

(might be slightly different, I ran mine as root because I had local overrides for my user profile for pip & pip3)

@kbondarev
Copy link
Collaborator

kbondarev commented Jul 20, 2022

I might've made a symlink long time ago: /usr/bin/python -> /usr/bin/python3 and maybe similar with pip (kinda vaguely remember now doing something like that)

$ for i in pip python pip3 python3 ; do command -v "${i}" ; done
/usr/local/bin/pip
/usr/bin/python
/usr/local/bin/pip3
/usr/bin/python3

If I want to reset everything to defaults.. any idea how I'd go about it?
Maybe I'll try doing all this in a fresh Ubuntu VM later on today as well.

@elreydetoda
Copy link
Collaborator Author

Ya, later tonight I can also commit a Vagrantfile as well so we have a consistently provisioned VM if you want.

@kbondarev
Copy link
Collaborator

Nah that sounds too much and unnecessary:))
It looks like it’s only weird lol env.
I will deal with it and then merge everything as I confirm it works nice.
Just need to find the time… and it’s not that urgent at the moment so I keep pushing it.

@elreydetoda
Copy link
Collaborator Author

elreydetoda commented Jul 21, 2022

Lol, my B I didn't see your comment before I pushed this morning (got tied up trying to do V4V last night for a JB episode 😅). I'm just now catching up on issue comments 🙃
It's there if you want to use it, or I can revert if you want (up to you) 😁

Also, ya no problem take your time, it's more of a nice to have than a need 🙂
I just did it, because it was really easy 😅

@elreydetoda elreydetoda mentioned this pull request Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using pipenv for deps managment
2 participants