unable to resolve 'no module named appium' error

  • Last Update :
  • Techknowledgy :

I am setting up my environment for automation using browserstack. I tried to implement the following code based on their instructions:

from Appium
import webdriver
enter code here`from Appium.webdriver.common.mobileby import MobileBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

userName = "cathytest1"
accessKey = "5u8P4kxrPdw3bCDPtyCU"

desired_caps = {
    "build": "Python Android",
    "device": "Samsung Galaxy S8 Plus",
    "app": "bs://fa77cdc35c9dea891b543c3ab6bf2897b300e229"
}

driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub- 
cloud.browserstack.com/wd/hub", desired_caps)

search_element = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search 
Wikipedia"))
)
search_element.click()

search_input = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ID, 
"org.wikipedia.alpha:id/search_src_text"))
)
search_input.send_keys("BrowserStack")
time.sleep(5)

search_results = 
driver.find_elements_by_class_name("android.widget.TextView")
assert(len(search_results) > 0)

driver.quit()

But I got the following error:

Traceback (most recent call last):
File "/Applications/Eclipse.app/Contents/MacOS/C:\EclipseWorkspaces\csse120/Browserstack/src/Sample/__init__.py", line 1, in <module>
   from Appium import webdriver
   ModuleNotFoundError: No module named 'Appium'

Suggestion : 2

I have already set up Appium in my Eclipse anycodings_browserstack IDE via Marketplace but still, the issue anycodings_browserstack isn't resolved.,Upgrade to Python 3 and then install the anycodings_appium Appium. I have faced the same issue and anycodings_appium it get solved once updated to Python 3. ,Are you sure you have appium installed? anycodings_appium If no, install it via pip: pip install anycodings_appium Appium-Python-Client and then try to anycodings_appium replace Appium with appium in your code. anycodings_appium In my system, it worked,I am setting up my environment for anycodings_browserstack automation using browserstack. I tried to anycodings_browserstack implement the following code based on their anycodings_browserstack instructions:

I am setting up my environment for anycodings_browserstack automation using browserstack. I tried to anycodings_browserstack implement the following code based on their anycodings_browserstack instructions:

from Appium
import webdriver
enter code here`from Appium.webdriver.common.mobileby import MobileBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

userName = "cathytest1"
accessKey = "5u8P4kxrPdw3bCDPtyCU"

desired_caps = {
    "build": "Python Android",
    "device": "Samsung Galaxy S8 Plus",
    "app": "bs://fa77cdc35c9dea891b543c3ab6bf2897b300e229"
}

driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub- 
cloud.browserstack.com/wd/hub", desired_caps)

search_element = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search 
Wikipedia"))
)
search_element.click()

search_input = WebDriverWait(driver, 30).until(
    EC.element_to_be_clickable((MobileBy.ID, 
"org.wikipedia.alpha:id/search_src_text"))
)
search_input.send_keys("BrowserStack")
time.sleep(5)

search_results = 
driver.find_elements_by_class_name("android.widget.TextView")
assert(len(search_results) > 0)

driver.quit()

But I got the following error:

Traceback (most recent call last):
File "/Applications/Eclipse.app/Contents/MacOS/C:\EclipseWorkspaces\csse120/Browserstack/src/Sample/__init__.py", line 1, in <module>
   from Appium import webdriver
   ModuleNotFoundError: No module named 'Appium'

Suggestion : 3

You must first install the package before you can use it in your code. Run the following command to install the package and its dependencies.

You must first install the package before you can use it in your code. Run the following command to install the package and its dependencies.

pip install appium - python - client

Suggestion : 4

We could not open your Appium test ZIP file. Please verify that the file is valid and try again.,We could not find a valid test file in the tests directory tree. Please unzip your test package and then open the tests directory, verify that at least one file's name starts or ends with the keyword "test", and try again.,We could not find the requirements.txt file inside your test package. Please unzip your test package, verify that the requirements.txt file is inside the package, and try again.,We could not find the tests directory inside your test package. Please unzip your test package, verify that the tests directory is inside the package, and try again.

Copy your test package to your working directory, and then run the following command:

$ unzip test_bundle.zip

After you successfully unzip the package, you can find the working directory tree structure by running the following command:

$ tree.

A valid Appium Python package should produce output like the following:

. |
--requirements.txt |
   --test_bundle.zip |
   --tests(directory) |
   `-- test_unittest.py
`--wheelhouse(directory) |
   --Appium_Python_Client - 0.20 - cp27 - none - any.whl |
   --py - 1.4 .31 - py2.py3 - none - any.whl |
   --pytest - 2.9 .0 - py2.py3 - none - any.whl |
   --selenium - 2.52 .0 - cp27 - none - any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

After you successfully unzip the package, you can find the working directory tree structure by running the following command:

$ tree.

If the Appium Python package is valid, you will find at least one .whl dependent file like the highlighted files inside the wheelhouse directory.

. |
--requirements.txt |
   --test_bundle.zip |
   --tests(directory) |
   `-- test_unittest.py
`--wheelhouse(directory) |
   --Appium_Python_Client - 0.20 - cp27 - none - any.whl |
   --py - 1.4 .31 - py2.py3 - none - any.whl |
   --pytest - 2.9 .0 - py2.py3 - none - any.whl |
   --selenium - 2.52 .0 - cp27 - none - any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

After you successfully unzip the package, you can find the working directory tree structure by running the following command:

$ tree.

If the Appium Python package is valid, you will find at least one .whl dependent file like the highlighted files inside the wheelhouse directory. The file's name may be different, but it should end with -any.whl or -linux_x86_64.whl, which specifies the platform. Any other platforms like windows are not supported.

. |
--requirements.txt |
   --test_bundle.zip |
   --tests(directory) |
   `-- test_unittest.py
`--wheelhouse(directory) |
   --Appium_Python_Client - 0.20 - cp27 - none - any.whl |
   --py - 1.4 .31 - py2.py3 - none - any.whl |
   --pytest - 2.9 .0 - py2.py3 - none - any.whl |
   --selenium - 2.52 .0 - cp27 - none - any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

After you successfully unzip the package, you can find the working directory tree structure by running the following command:

$ tree.

If the Appium Python package is valid, you will find the tests directory inside the working directory.

. |
--requirements.txt |
   --test_bundle.zip |
   --tests(directory) |
   `-- test_unittest.py
`--wheelhouse(directory) |
   --Appium_Python_Client - 0.20 - cp27 - none - any.whl |
   --py - 1.4 .31 - py2.py3 - none - any.whl |
   --pytest - 2.9 .0 - py2.py3 - none - any.whl |
   --selenium - 2.52 .0 - cp27 - none - any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

After you successfully unzip the package, you can find the working directory tree structure by running the following command:

$ tree.

If the Appium Python package is valid, you will find the tests directory inside the working directory. The file's name may be different, but it should start with test_ or end with _test.py.

. |
--requirements.txt |
   --test_bundle.zip |
   --tests(directory) |
   `-- test_unittest.py
`--wheelhouse(directory) |
   --Appium_Python_Client - 0.20 - cp27 - none - any.whl |
   --py - 1.4 .31 - py2.py3 - none - any.whl |
   --pytest - 2.9 .0 - py2.py3 - none - any.whl |
   --selenium - 2.52 .0 - cp27 - none - any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

Suggestion : 5

You do not need to include ecomstore when importing. Have you added catalog to your INSTALLED_APPS in your settings.py in the ecomstore project folder?,ImportError: No module named 'libstdcxx' when starting Eclipse debugger,ImportError when Importing Python Module into Java Program in Eclipse,Eclipse and Google App Engine: ImportError: No module named _sysconfigdata_nd; unrecognized arguments: --high_replication

E.g.:

INSTALLED_APPS = (
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.sites',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   # Uncomment the next line to enable the admin:
   'django.contrib.admin',
   # Uncomment the next line to enable admin documentation:
   # 'django.contrib.admindocs',
   'catalog'
)

Change the line to

from catalog.models
import Product