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

Bug: pip package manager related commands raises error #664

Closed
PrashanthPuneriya opened this issue Jul 14, 2020 · 45 comments · Fixed by #877
Closed

Bug: pip package manager related commands raises error #664

PrashanthPuneriya opened this issue Jul 14, 2020 · 45 comments · Fixed by #877
Assignees
Labels
Category: Quality Assurance Changes to code or files that improve testing or fixes bugs. First Timers Only Good for newcomers. Type: Bug Bug or Bug fixes.

Comments

@PrashanthPuneriya
Copy link
Contributor

Describe the bug

pip freeze, pip install and other various pip related commands doesn't work and raises error due to the six older version package.
It raises ImportError: cannot import name 'ensure_str' from 'six'

To Reproduce

Steps to reproduce the behavior:

  1. If you have a virtualenv folder then delete it and recreate the virtual environment as specified in the docs
  2. Activate the virtual environment
  3. Run pip install -r requirements.txt command.
  4. Now to see the error run any pip related commands. For example run pip freeze command.
  5. See the error

Expected behavior
pip related commands must be executed without running into any error.

Screenshots
Screenshot from 2020-07-14 13-50-42

@PrashanthPuneriya
Copy link
Contributor Author

I would like to take up and fix this bug.

@vj-codes
Copy link
Member

vj-codes commented Jul 14, 2020

Heyy @PrashanthPuneriya this issue does not seem to be valid as pip freeze does work with me .Can you see the Mentorship System API at local host on your computer?Might be a setup error from your side.I have approved the other issue!

cc : @anitab-org/mentorship-managers
Screenshot (18)

@vj-codes vj-codes added Help Wanted Extra attention is needed. Status: Needs Review PR needs an additional review or a maintainer's review. labels Jul 14, 2020
@PrashanthPuneriya
Copy link
Contributor Author

@vj-codes I think you haven't ran pip install -r requirements.txt command. Your virtual environment doesn't have all the requirements as specified in the requirements.txt file.

@vj-codes
Copy link
Member

vj-codes commented Jul 14, 2020

I did that when I first setup the repo .Can you run the project loacally? @PrashanthPuneriya

@PrashanthPuneriya
Copy link
Contributor Author

@vj-codes Please follow the procedure to reproduce the bug. You need to recreate the virtual environment again.

@SanketDG
Copy link
Contributor

@PrashanthPuneriya Last I checked, mentorship-backend does not work with 3.8. Were you able to run the application atleast once successfully?

@PrashanthPuneriya
Copy link
Contributor Author

@vj-codes @SanketDG No, I couldn't run the project locally. Not even once.

@SanketDG
Copy link
Contributor

@PrashanthPuneriya I would say try with 3.7 then, if you want to set up the environment now.

@vj-codes
Copy link
Member

Its working properly with me for 3.8 on windows @SanketDG
@PrashanthPuneriya You are on Ubuntu so dont have much idea, however I had faced issue #212 but the solution worked.

@PrashanthPuneriya
Copy link
Contributor Author

@SanketDG @vj-codes I think I have fixed this issue and #212 . I would confirm my hypothesis and let you know.

@PrashanthPuneriya
Copy link
Contributor Author

PrashanthPuneriya commented Jul 14, 2020

@vj-codes @SanketDG
I am posting this comment as a new comer to this project. So, please review and give feedback. I am using Python 3.8.2.

To fix #664 we got two work-arounds

Method-1 (Temporary work-around) :-

  • Upgrade six to 1.14.0
  • Upgrade werkzeug to >= 0.16.1

Method-2 (Permanent work-around) :-

  • Upgrade to flask-restx #605 fixes this issue
  • flask-restplus (which this project uses) created dependency issues for six and wekzeug. So, to fix this dependency issue we need to either follow Method-1 or Method-2(i.e. use flask-restx)
  • You can read more about dependency issues from here and here

To fix #212

  • Uninstall cffi (if this package isn't required. I haven't seen any dependency on this package until now. See this comment.)

@SanketDG
Copy link
Contributor

#605 doesn't fix all the dependency bugs, it just upgrades to flask-restx.

It's a pretty common library to be used by packages that are written in C and have python bindings, so it's probably installed as a dependency of some other package.

Can you do an audit of all packages in requirements to make sure no unneeded dependency is present? Then please open a PR with all dependencies updated to their latest versions! We are doing the same for portal

Let me know if you have any questions.

@PrashanthPuneriya
Copy link
Contributor Author

PrashanthPuneriya commented Jul 14, 2020

@SanketDG Okay! But, I think before auditing the dependencies for this project we must fix #400 (#400 removes major unrequired dependencies which makes the work much easier).
Aren't we using python3 already? If we are using python3 then we must move from virtualenv to venv i.e. fix #400.

@PrashanthPuneriya
Copy link
Contributor Author

@SanketDG @vj-codes @isabelcosta I did some dig up in commits to find out when cffi package was first included in the requirements.txt file. #207 was the pull request when it was first included.
I haven't seen any code in that particular pull request which are dependent on the following packages:- cffi, asn1crypto, cryptography and these packages are not futher required by other packages.

So, I think we can safely remove cffi package and go ahead with the temporary work-around as mentioned above.

@SanketDG this might be the first step towards auditing the dependencies.

@vj-codes
Copy link
Member

@SanketDG so this issue is valid right?
If yes then,
@PrashanthPuneriya you can only work for one issue at a time. So, which one of the two issues would you like to fix first?

@vj-codes
Copy link
Member

Remember that the other issue is for first timers only so you can't work on that later @PrashanthPuneriya

@PrashanthPuneriya
Copy link
Contributor Author

PrashanthPuneriya commented Jul 14, 2020

@vj-codes I would like to fix #663 issue first

@vj-codes vj-codes added Category: Coding Changes to code base or refactored code that doesn't fix a bug. Type: Bug Bug or Bug fixes. labels Jul 14, 2020
@PrashanthPuneriya
Copy link
Contributor Author

Update

@vj-codes @SanketDG @anitab-org/mentorship-managers I have updated the above comment. Please go through it once again and review it.

@isabelcosta If you review this comment then we can proceed futher.

Thanks!

@SanketDG
Copy link
Contributor

@PrashanthPuneriya Feel free to do any of the above, what ultimately matters is that we upgrade each and every dependency and then automate it using https://github.com/marketplace/dependabot-preview

Please don't selectively upgrade, upgrade every dependency and see what breaks. We can iterate from there.

And yes, you can choose to not upgrade anything involves flask-restplus. since my PR already covers that.

@PrashanthPuneriya PrashanthPuneriya added Category: Quality Assurance Changes to code or files that improve testing or fixes bugs. Open Source Hack and removed Category: Coding Changes to code base or refactored code that doesn't fix a bug. Help Wanted Extra attention is needed. Open Source Hack Status: Needs Review PR needs an additional review or a maintainer's review. labels Aug 24, 2020
@PrashanthPuneriya PrashanthPuneriya self-assigned this Aug 24, 2020
@PrashanthPuneriya PrashanthPuneriya added the First Timers Only Good for newcomers. label Sep 3, 2020
@soumyjain14
Copy link

Hey thanks, @PrashanthPuneriya , Let me try this

@soumyjain14
Copy link

sorry unable to find a clue :(
New to open source, don't know how to start

@PrashanthPuneriya
Copy link
Contributor Author

No worries @soumyjain14! Did you successfully set up the project? At which part are you clueless? Let me help you getting started 😃

@PrashanthPuneriya
Copy link
Contributor Author

If you have successfully set up the project locally and replicated the error then start by googling out the error and always read the prevs comments to get more hints :)

@PrashanthPuneriya
Copy link
Contributor Author

Are you still working on this @soumyjain14 ? Or should I assign someone else?

@PrashanthPuneriya PrashanthPuneriya added the Status: Available Issue was approved and available to claim or abandoned for over 3 days. label Sep 8, 2020
@pallavisavant
Copy link
Contributor

Yes i would like to work...lemme take this up

@PrashanthPuneriya PrashanthPuneriya removed the Status: Available Issue was approved and available to claim or abandoned for over 3 days. label Sep 12, 2020
@PrashanthPuneriya PrashanthPuneriya added the Status: Available Issue was approved and available to claim or abandoned for over 3 days. label Sep 12, 2020
@PrashanthPuneriya
Copy link
Contributor Author

Oh sorry @pallavisavant I can't assign you. This is a first-timer issue. My bad I didn't checked thoroughly. I will mention you whenver I see a suitable issue.

@pallavisavant
Copy link
Contributor

@PrashanthPuneriya oh okay ya thanks...👍

@devkapilbansal
Copy link
Member

@PrashanthPuneriya I want to work on this issue

@PrashanthPuneriya
Copy link
Contributor Author

Sure @KapilBansal320. Assigning you :)

@PrashanthPuneriya PrashanthPuneriya removed the Status: Available Issue was approved and available to claim or abandoned for over 3 days. label Sep 15, 2020
@devkapilbansal
Copy link
Member

Hi, @PrashanthPuneriya I tested it on Python 3.8.2 on Ubuntu 20.04 and it seems to work perfectly for me.
TLDR
Here are some images confirming the same
s1
s2
s3
s4

Although I will test it on Windows too but I don't think this issue is still valid or can you please guide me where I am going wrong?

@PrashanthPuneriya
Copy link
Contributor Author

Hey @KapilBansal320 I just tested it again by recreating the environment and I am still getting the same error.
image

@devkapilbansal
Copy link
Member

devkapilbansal commented Sep 17, 2020

Hey @KapilBansal320 I just tested it again by recreating the environment and I am still getting the same error.
image

@PrashanthPuneriya Okay can you provide me with the OS you are using also the version of Python too

@PrashanthPuneriya
Copy link
Contributor Author

@KapilBansal320
OS -> Ubuntu 20.04
Python 3.8.2
pip 20.0.2

@devkapilbansal
Copy link
Member

devkapilbansal commented Sep 17, 2020

@PrashanthPuneriya please review pull request #877

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Quality Assurance Changes to code or files that improve testing or fixes bugs. First Timers Only Good for newcomers. Type: Bug Bug or Bug fixes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants