Code Monkey home page Code Monkey logo

Comments (11)

lukeyeager avatar lukeyeager commented on May 21, 2024 1

I have seen this error before:

ImportError: cannot import name DataRequired

And I fixed it by running pip install --upgrade Flask-WTF. I'm not sure why that's not working for you.

A little googling makes me suspect that you have an older version of pip and/or distribute installed?

from digits.

mnmoustafa avatar mnmoustafa commented on May 21, 2024

I think I have the latest versions of packages. Here are some diagnostics:

$ apt-cache policy python-pip
python-pip:
  Installed: 1.5.4-1
  Candidate: 1.5.4-1
  Version table:
 *** 1.5.4-1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

and

$ apt-cache policy python-setuptools
python-setuptools:
  Installed: 3.3-1ubuntu1
  Candidate: 3.3-1ubuntu1
  Version table:
 *** 3.3-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

but I am not sure why flast-wtf latest version is 0.6 not 0.11? (I have the latest apt-get update)

$ apt-cache policy python-flaskext.wtf
python-flaskext.wtf:
  Installed: 0.6-1
  Candidate: 0.6-1
  Version table:
 *** 0.6-1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status

Thanks,

from digits.

lukeyeager avatar lukeyeager commented on May 21, 2024

I'm running a virtualenv on my machine, which allows me to "overwrite" the system level package (v0.6) with the latest (v0.11) in my local directory. If you whack your package that was installed with apt-get, pip should be able to do its thing. Try this:

sudo apt-get purge python-flaskext.wtf
pip install --upgrade Flask-WTF

For reference, here are the versions that come with apt-get:

% pip list | grep -i wtf
Flask-WTF (0.6)
WTForms (1.0.1)

And here is what pip gives me:

% pip list | grep -i wtf
Flask-WTF (0.11)
WTForms (2.0.2)

from digits.

mnmoustafa avatar mnmoustafa commented on May 21, 2024

I purged the existing flaskext.wtf package and

$sudo pip install --upgrade Flask-WTF                                                       
Downloading/unpacking Flask-WTF
  Downloading Flask_WTF-0.11-py2.py3-none-any.whl
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1259, in prepare_files
    )[0]
IndexError: list index out of range

Storing debug log for failure in /tmp/tmpte0BRy

flask-wtf is not installed/upgraded for some reason.. now my pip gives me:

pip list | grep -i wtf
wtf (0.1)
WTForms (1.0.1)

from digits.

lukeyeager avatar lukeyeager commented on May 21, 2024

Have you tried this?

from digits.

mnmoustafa avatar mnmoustafa commented on May 21, 2024

This is it. Updating pip and distribute solved the problem. Thank you lukeyeager.

from digits.

afshindn avatar afshindn commented on May 21, 2024

on one of my machines, I'm getting the following error while running ./digits-devserver. I thought this might be related to this post. Any idea how to fix it?

Traceback (most recent call last):
File "./digits-devserver", line 31, in
from digits import config
File "/media/data/common/digits4/digits/config/init.py", line 7, in
from .current_config import config_value
File "/media/data/common/digits4/digits/config/current_config.py", line 4, in
from .caffe_option import CaffeOption
File "/media/data/common/digits4/digits/config/caffe_option.py", line 14, in
from digits.utils import parse_version
File "/media/data/common/digits4/digits/utils/init.py", line 158, in
from . import constants, image, time_filters, errors, forms, routing, auth
File "/media/data/common/digits4/digits/utils/forms.py", line 8, in
from wtforms.compat import string_types
ImportError: No module named compat

Here is the version of Flask and wtforms that I have installed.
Flask-WTF (0.12)
WTForms (2.1)

Thanks

from digits.

gheinrich avatar gheinrich commented on May 21, 2024

It is strange, the compat module has been in WTForms for a long time. Is it possible that you have several versions of WTForms on your system? Maybe check the contents of the wtforms package in your Python site-packages...

from digits.

afshindn avatar afshindn commented on May 21, 2024

this is all the files I have in dist-packages for wtforms. And I believe this is the only version I have installed.

compat.py ext form.pyc init.py meta.py utils.pyc widgets
compat.pyc fields i18n.py init.pyc meta.pyc validators.py
csrf form.py i18n.pyc locale utils.py validators.pyc

from digits.

lukeyeager avatar lukeyeager commented on May 21, 2024

Try this just to be sure:

$ python -c 'import wtforms;print wtforms.__file__;print wtforms.__version__'
/usr/lib/python2.7/dist-packages/wtforms/__init__.pyc
2.1

from digits.

afshindn avatar afshindn commented on May 21, 2024

@lukeyeager and @gheinrich

Your guess was right. I had two versions on the wtforms. One in "/usr/local/lib/python2.7/dist-packages" and one in "/usr/lib/python2.7/dist-packages". Pip installed the 2.1 version under /usr/local/lib while python was using the version 1.0.1 for /usr/lib/.

I had to purge the old one and the problem is solved now. Thanks

from digits.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.