factory_boy: ImportError: The ``fake-factory`` package is now called ``Faker``.

Trying to import factory, but it looks like since yesterday, one of the required packages has changed it’s name:

    import factory
  File "/venv/lib64/python3.5/site-packages/factory/__init__.py", line 46, in <module>
    from .faker import Faker
  File "/venv/lib64/python3.5/site-packages/factory/faker.py", line 41, in <module>
    import faker
  File "/venv/lib64/python3.5/site-packages/faker/__init__.py", line 7, in <module>
    raise ImportError(error)
ImportError: The ``fake-factory`` package is now called ``Faker``.

Edit: I now see there’s already a commit to fix this. Any chance of a release to pypi?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 46
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Just fixed with 2.8.1 — I had to upload a couple of versions to fix an issue with recent setuptools versions.

Sorry for the release lag 😕

@jdufresne seems so, yes…

It broke our tests in Travis: https://travis-ci.org/ideascube/ideascube/builds/184587115

However, the same tests run just fine here in my pre-existing venv.

That’s because in my existing venv I have fake-factory==0.7.2 which satisfies the requirement on fake-factory>=0.5.0 from factory_boy (2.7.0).

But then when creating a new venv and installing factory_boy, then pip will download the latest version of fake-factory==9999.9.9, which only contains:

VERSION = '9999.9.9'

error = """The ``fake-factory`` package is now called ``Faker``.

Please update your requirements.
"""
raise ImportError(error

Nice.

Can we have a new release of factory_boy using Faker, please? 😃

I ran into this as well – the solution that worked for me was to reference fake-factory in my requirements.txt file (before factory-boy):

fake-factory==0.7.4
factory-boy==2.7.0

Oops. We already swapped over to the new name back in this commit: https://github.com/FactoryBoy/factory_boy/commit/dba31e3866cdefde1d7f37fc7f0553a12feeab9b

However, looks like we forgot to cut a new release. @rbarrois is likely asleep right now, but hopefully he can get to it when he wakes up as I don’t have Pypi rights for this project.

I’ve having the same issue please fix import and bump version

We are already aware of this. Please use the thumbs up button rather than spamming everyone with a “me too”. Thanks.

PS: For now, a simple workaround is to temporarily install off of master branch where this is already fixed as described in https://github.com/FactoryBoy/factory_boy/issues/334#issuecomment-267672355

Looks like everyone is having a same problem here 😉

Faker library released the latest version 0.7.5 which deprecates fake-factory package name.

screen shot 2016-12-16 at 11 01 21 am

If factory-boy uses Faker 0.7.4, the issue could be resolved.

First uninstall fake-factory using

pip uninstall fake-factory

Then check if it is uninstalled using

pip freeze

Then, proceed with installing Faker by,

pip install Faker