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

"pipenv install" is unclear to me #6048

Open
buhtz opened this issue Dec 21, 2023 · 12 comments · May be fixed by #6098
Open

"pipenv install" is unclear to me #6048

buhtz opened this issue Dec 21, 2023 · 12 comments · May be fixed by #6098
Labels
Category: Future Issue is planned for the future.

Comments

@buhtz
Copy link

buhtz commented Dec 21, 2023

It is unclear to me what the purpose of pipenv install is.

Usually I do install packages via pip in a virtual environment. So what is the advantage of pipenv install?

@DanielSwain
Copy link

StackOverflow would be a better place to post a support-type question like this, but in a nutshell, pipenv install, when used by itself, creates a new venv if none exists and then installs into the venv everything found in Pipfile. If a specific package is named (pipenv install package_name), then it installs that package into the venv (and starts by creating the venv if it doesn't already exist). Install also creates or updates Pipfile.lock.

@buhtz
Copy link
Author

buhtz commented Dec 21, 2023

StackOverflow would be a better place to post a support-type question like this

Such answer feels a bit inpolite from my point of view.

Then why do you offer a "Usage / Requests for Help" section in your Issues?

From maintainer to maintainer: Youcould treat question from your users as an opportunity to improve your docu or the way/path to the docu.

If a specific package is named (pipenv install package_name), then it installs that package into the venv (and starts by creating the venv if it doesn't already exist)

In this case it would be a short form of this?

pipenv shell
pip install mypackage

@DanielSwain
Copy link

DanielSwain commented Dec 21, 2023

@buhtz Just a pipenv user here, not a maintainer. I certainly didn't mean to be impolite and didn't mean that your question was a bad one, so I'm sorry that my answer sounded brusque. I was just suggesting StackOverflow because your question would then be there permanently for anyone to see vs being in an issue here that will be closed at some point and might not be as easily discovered. I agree that the docs could use a bit of improvement, but I know that the primary maintainer is doing his best to keep up with the issues here (I just submitted one myself a few days ago), and so I doubt if he's had time to also update the docs. Overall, I've used pipenv for years and have been very happy with it.

To answer your last question there: You would do pipenv install mypackage BEFORE doing pipenv shell. pipenv shell activates the virtual environment. You never use pip along with pipenv other than to do pip install pipenv to initially install pipenv on your machine (or pip install --upgrade pipenv to upgrade).

@buhtz
Copy link
Author

buhtz commented Dec 21, 2023

You never use pip along with pipenv other than to do pip install pipenv to initially install pipenv on your machine (or pip install --upgrade pipenv to upgrade).

But I do use pip inside the environment and couldn't discover a problem yet.
So when I can not use pip then why should I use a virtual environment.
Now I am totally confused and maybe misinterpret the purpose of pipenv.

@DanielSwain
Copy link

In general, I like the summary that https://search.brave.com provides when I do a search, so this information might be useful.

@Ganesh2409
Copy link

Ganesh2409 commented Dec 21, 2023

Pipenv is virtual Environment management tool which automatically creates and manages a virtual environment for your projects, as well as adds and removes dependencies.

When you run pipenv install, it not only installs the specified package but also creates a Pipfile and Pipfile.lock to manage project dependencies. This helps in ensuring consistent and reproducible environments for your projects.

Where to Use pipenv and pip

*** Large Team Collaboration****

Using pipenv: Suppose you're part of a large development team working on a complex project. With pipenv, you can easily share and replicate the project's environment using the Pipfile and Pipfile.lock, ensuring that everyone works with the same package versions.

Using pip: In a large team setting, if the team has a well-established process for virtual environment management and dependency tracking, using pip in conjunction with a requirements.txt file might be the preferred approach.

Iam new to this platform and opensource contributions ,If there are any mistakes please teach me i will eventually learn .... :)

@buhtz
Copy link
Author

buhtz commented Dec 22, 2023

Are there plans to support pyproject.toml?

The point is I do not use pipfile and I do not need to create or manage a virtual env. What I like on pipenv is that it creates a virtual env and open it in a sub-shell. Managing dependencies should not be its concern. There is pip and the pyproject.toml for that. I open the environment via "pipenv shell" and then just do "python3 -m pip install ." and everything is fine.
This is also reproducible for other project members.

@aradkdj
Copy link

aradkdj commented Dec 22, 2023

The way you use pipenv seems to be more in line with either venv or virtualenv. Have you given them a shot?

@buhtz
Copy link
Author

buhtz commented Dec 22, 2023

Yes, I gave them a shot. But they do not open a sub-shell.

@aradkdj
Copy link

aradkdj commented Dec 22, 2023

If you really need a subshell and support for installing dependencies from pyproject.toml perhaps hatch will help you.

@adithya-vedhamani
Copy link

What is pipenv and pipenv install?

Purpose of pipenv install:

  • pipenv is a tool that helps you manage your Python project's dependencies and environment.
  • When you run pipenv install, it sets up a virtual environment for your project and installs the required packages.

Advantages of pipenv install over pip in a virtual environment:

  1. Dependency Management:

    • Purpose: With pipenv, you declare your project's dependencies in a simple file.
    • Advantages: This ensures everyone working on the project uses the same packages, making collaboration smoother.
    • Docs: Pipenv Basics
  2. Virtual Environment Magic:

    • Purpose: pipenv automatically creates and manages a virtual environment for your project.
    • Advantages: No worries about clashes with system-wide Python or different project requirements.
    • Docs: Pipenv Features
  3. Automatic Activation:

    • Purpose: pipenv activates your virtual environment when you enter your project.
    • Advantages: It's always on when you need it, and off when you don't, preventing accidental global installations.
    • Docs: Pipenv Basics
  4. Dependency Locking:

    • Purpose: pipenv locks down specific versions of your dependencies.
    • Advantages: Ensures everyone uses the same package versions, reducing "it works on my machine" issues.
    • Docs: Pipenv Features
  5. Simplified Workflow:

    • Purpose: pipenv combines package management and virtual environments in one.
    • Advantages: Easier commands and less setup, making your development workflow smoother.
    • Docs: Pipenv Basics

It's like a friendly assistant that takes care of your project's needs.

@buhtz
Copy link
Author

buhtz commented Jan 22, 2024

Thanks for this explanation. I am sorry but I disagree in some points.

  1. Dependency Management:

    • Purpose: With pipenv, you declare your project's dependencies in a simple file.

This is IMHO a disadvantage. It is a redundant feature because Pythons build environment can handle that via pyproject.toml file itself. Having another file with such information is redundant and can introduce bugs.

  1. Simplified Workflow:

    • Purpose: pipenv combines package management and virtual environments in one.

As you can see in my case this "combination" is a problem. I am not interested in package management and I do not need it because Python itself does provide it.
I only need virtual environment features; e.g. the automatic activation when entering the folder and things like this.

@matteius matteius added the Category: Future Issue is planned for the future. label Feb 7, 2024
@matteius matteius linked a pull request Apr 2, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Future Issue is planned for the future.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants