0

I'm trying to run uninstall flask 0.9.1 to install 0.9.0 instead because i get the error

  ascii_attachments = current_app.extensions['mail'].ascii_attachments

KeyError: 'mail'

and i read from this post= 'Python Flask Email KeyError KeyError: 'mail''

that this was the solution

Error: The file/path provided (routes) does not appear to exist.  Please verify the path is correct.  If app is not on PYTHONPATH, ensure the extension is .py

so I checked pip and I got this error:

bash: usr/local/bin/pip: No such file or directory

I thought it might be due to the cash, so I typed:

hash -r

however, the same problem occurs afterward. Any ideas on what I can do?

EDIT:

whenver i type:

$ which pip

i get this directory back: /usr/local/bin/pip

kristheman
  • 89
  • 1
  • 13
  • 2
    `usr/local/bin/pip` seems to be missing a leading `/`. – user2357112 Jun 24 '18 at 22:14
  • should I alias it as something else? Or how can i change the name? – kristheman Jun 24 '18 at 22:14
  • 3
    Flask doesn't need pip in order to run – OneCricketeer Jun 24 '18 at 22:14
  • How can i fix my path to pip? – kristheman Jun 24 '18 at 22:25
  • I apologize the error from flask was an input error – kristheman Jun 24 '18 at 22:25
  • Can you please show `echo $PATH`? If you run `/usr/local/bin/pip` yourself, what happens? – OneCricketeer Jun 24 '18 at 22:27
  • /home/kristoffer/bin:/home/kristoffer/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin – kristheman Jun 24 '18 at 22:30
  • I have no idea, why it is liking java dependencies – kristheman Jun 24 '18 at 22:30
  • Have you tried `python -m pip`? – Lane Terry Jun 24 '18 at 22:30
  • @Lane Terry: yes whenever i do this, it lists the correct directory Usage: /usr/bin/python -m pip [options] – kristheman Jun 24 '18 at 22:31
  • 1
    What OS and version? Are you running the flask app as root or the local user? Also, the problem should be able to be resolved by `python -m pip uninstall flask-mail && python -m pip install flask-mail==0.9.0` correct? – Lane Terry Jun 24 '18 at 22:33
  • Ubuntu 16.04, yes i'm calling the export command and running flask run – kristheman Jun 24 '18 at 22:34
  • 1
    Assuming pip isn't on the root user's path, causing the issue `bash: usr/local/bin/pip: No such file or directory`. Run the commands I put in the edit above as root and see if that fixes the issue. – Lane Terry Jun 24 '18 at 22:36
  • this would work if i ran it it as a sudo command. However after installing some of the dependencies i get this error: – kristheman Jun 24 '18 at 22:37
  • Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/flask_mail.py' Consider using the `--user` option or check the permissions. – kristheman Jun 24 '18 at 22:37
  • 1
    @kristheman See above. If you need to run the flask app as root, install the packages as root. If not, install using --user as mentioned. I suggest researching virtualenv if you're having trouble handling these issues. – Lane Terry Jun 24 '18 at 22:44
  • Should i use a virtualenv for this? I mean even if i run as sudo i still get an error, telling my to use the --user argument? – kristheman Jun 24 '18 at 22:48
  • 1
    I don't see a reason why your root user would be unable to access that path. You can try `chown root:root /usr/local/lib/python2.7/dist-packages/flask_mail.py`, but again, if you don't have a decent grasp of how to manage a Linux instance virtualenv is going to make your life easier. Running that command could break some things for the local user, so replacing `root:root` with `user:group` is preferable. – Lane Terry Jun 24 '18 at 22:53

0 Answers0