Mentorship-backend: Bug: pip package manager related commands raises error

Created on 14 Jul 2020  路  45Comments  路  Source: anitab-org/mentorship-backend

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

Quality Assurance First Timers Only Bug

All 45 comments

I would like to take up and fix this bug.

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 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.

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

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

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

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

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

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.

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

@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) :-

  • #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.)

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

  • Uninstall cffi (if this package isn't required. I haven't seen any dependency on this package until now). This apparently fixes #212

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.

@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.

@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.

@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?

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

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

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!

@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 Can you update the description to explicitly mention what needs to be done here?

@SanketDG Just tested this. When did we merged #605 :P?. #605 solved most of the problem. After merging #713 we can close this issue.

Yeah that's what I thought, sounds good, we can remove the OSH label right?

I have tested this only on Python 3.8. Let me confirm with other versions and decide whether to close this issue or not :)

I would like to work on this issue as a part of OSH. Can you assign me this issue? Thank You.

Sure @Abjcodes ! But, can you wait for a while until #713 gets merged? As of now this issue stands valid but, we need to test again after merging the mentioned PR and see for other new issues.

Hi, I would like to work in the open source Hack, can someone assign any task to me?

@SanketDG @PrashanthPuneriya I want to work on this issue and I think I can fix this easily.

@SanketDG This issue is still valid. Earlier, I tested it without even running pip related command. My bad :laughing:

I am making this issue as first-timers-only since, it is quite simple to fix.
Sorry @Abjcodes, this means I can't assign you this issue since, you have already created a PR.

Assigning @soumyjain14 :)

Hey thanks, @PrashanthPuneriya , Let me try this

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

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

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 :)

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

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

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.

@PrashanthPuneriya oh okay ya thanks...馃憤

@PrashanthPuneriya I want to work on this issue

Sure @KapilBansal320. Assigning you :)

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?

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

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

@KapilBansal320
OS -> Ubuntu 20.04
Python 3.8.2
pip 20.0.2

@PrashanthPuneriya please review pull request #877

Was this page helpful?
0 / 5 - 0 ratings