-1

when i want to run an py file, it doesn't opened

look, it's a Instapy file, and when i already installed; py -3 -m pip install instapy and installed, buy when i want to run my file they told you have an error on " from instapy import InstaPy "

wait, when i put on powerShell;

PS C:\Users\miroc\Desktop\insta py> py instagram_bot.py

they say;

Traceback (most recent call last):
  File "C:\Users\miroc\Desktop\insta py\instagram_bot.py", line 1, in <module>
    from instapy import InstaPy
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\instapy\__init__.py", line 6, in <module>
    from .instapy import InstaPy
  File "C:\Python311\Lib\site-packages\instapy\instapy.py", line 34, in <module>
    from .browser import close_browser, set_selenium_local_session
  File "C:\Python311\Lib\site-packages\instapy\browser.py", line 14, in <module>
    from .util import interruption_handler
  File "C:\Python311\Lib\site-packages\instapy\util.py", line 27, in <module>
    from emoji.unicode_codes import UNICODE_EMOJI
ImportError: cannot import name 'UNICODE_EMOJI' from 'emoji.unicode_codes' (C:\Python311\Lib\site-packages\emoji\unicode_codes\__init__.py)

so what i can do to fix that error, btw i have been install InstaPy package file

Olaf
  • 4,690
  • 2
  • 15
  • 23
reblox
  • 1
  • 2

2 Answers2

1

Upgrade the emoji library to the latest version. You can do this by running the following command in your terminal or command prompt: "pip install --upgrade emoji"

-Uninstall the emoji library and reinstall it. You can do this by running the following command in your terminal or command prompt: "pip uninstall emoji" followed by "pip install emoji"

RockYou
  • 21
  • 5
  • the same error, i unisntalled and i have been installed again but still the same error – reblox Jan 29 '23 at 12:14
  • Use a virtual environment: create a new virtual environment for your project and install the required libraries including instapy and emoji in that environment. This can help isolate the dependencies and avoid conflicts with other packages. – RockYou Jan 29 '23 at 12:18
1

This is a known issue that was solved by this pull request. However a new version with the fix has not been released on pypi.org yet.

So the InstaPy version on pypi.org is not compatible with the latest version of the emoji package.

You need to either install an older version of the emoji package like so:

pip uninstall emoji
pip install emoji==1.6.3

Or you need to install InstaPy directly from the github repository which includes the fix:

pip uninstall instapy
pip install git+https://github.com/InstaPy/InstaPy

At the moment, InstaPy is not usable as far as I know. You should consider using InstaPy2 as a replacement for InstaPy.

cuzi
  • 978
  • 10
  • 21