mega.py: cannot import name 'Mega' from 'mega'
I just created a new Ubuntu 20.4.1 VM on Windows 10 / Hyper-V and I ran pip3 install mega.
When I run from mega import Mega in a Python 3.8.2 interpreter I get ImportError: cannot import name 'Mega' from 'mega' (/home/dowcet/.local/lib/python3.8/site-packages/mega/__init__.py\
I have confirmed that path /home/dowcet/.local/lib/python3.8/site-packages/mega/__init__.py exists, and it contains both __init__.py and mega.py
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 18
Hi , I think you installed the wrong pip package. you should have installed :
pip3 install mega.pyI suggest removing the old package like this :pip3 uninstall megaand then:pip3 install mega.pyhope it helpswork for me thanks!
Oh my god it worked! Thank you!
For me it worked using:
from mega.mega import MegaTry to upgrade
tenacity.I have a similar issue:
[/root/mirrorbot]:# ./start.sh /bin/sh: 1: gunicorn: not found Bad command line: You cannot use -d (or --daemon): qBittorrent is already running for this user. Run application with -h option to read about command line parameters. 2022-09-24 12:53:57,453 - bot - INFO - Generating USER_SESSION_STRING 2022-09-24 12:53:57,454 - bot - INFO - Generating TELEGRAPH_TOKEN using ‘zqBukQPu’ name 2022-09-24 12:53:57,689 - root - WARNING - MEGA Credentials not provided! 2022-09-24 12:53:57,690 - root - WARNING - BASE_URL_OF_BOT not provided! Traceback (most recent call last): File “/root/anaconda3/lib/python3.7/runpy.py”, line 193, in _run_module_as_main “main”, mod_spec) File “/root/anaconda3/lib/python3.7/runpy.py”, line 85, in _run_code exec(code, run_globals) File “/root/mirrorbot/bot/main.py”, line 20, in <module> from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, torrent_search, delete, speedtest, count, leech_settings File “/root/mirrorbot/bot/modules/mirror.py”, line 25, in <module> from bot.helper.mirror_utils.download_utils.mega_downloader import MegaDownloadHelper File “/root/mirrorbot/bot/helper/mirror_utils/download_utils/mega_downloader.py”, line 3, in <module> from mega import (MegaApi, MegaListener, MegaRequest, MegaTransfer, MegaError) ImportError: cannot import name ‘MegaApi’ from ‘mega’ (/root/anaconda3/lib/python3.7/site-packages/mega/init.py)
Itried everything, any idea?
I was having the same problem.
Your python file name is probably mega.py Change it