Docker-compose ps error - docker-compose

I am new to docker-compose and getting the following error when I type in docker-compose ps.
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/Library/Python/2.7/site-packages/compose/cli/main.py", line 20, in <module>
from ..bundle import get_image_digests
File "/Library/Python/2.7/site-packages/compose/bundle.py", line 14, in <module>
from .service import format_environment
File "/Library/Python/2.7/site-packages/compose/service.py", line 37, in <module>
from .parallel import parallel_execute
File "/Library/Python/2.7/site-packages/compose/parallel.py", line 10, in <module>
from six.moves import _thread as thread
ImportError: cannot import name _thread

Docker-compose is written by python. It seems that you miss some python packages. You can refer to the following page of how to fix the python lib issue.
Matplotlib issue on OS X ("ImportError: cannot import name _thread")
Alternatively, you can try to install docker-compose as a container, the docker container contains appropriate environment for docker-compose.
https://docs.docker.com/compose/install/#install-as-a-container

Related

I run odoo 15 on vs-code but these errors appear what the solution for these?

The errors is:
( /usr/bin/env /bin/python3 /home/abdulrahman/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 37511 -- /home/abdulrahman/odoo/odoo-15.0/odoo-bin --config=/home/a /usr/bin/env /bin/python3 /home/abdulrahman/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 37511 -- /home/abdulrahman/odoo/odoo-15.0/odoo-bin --config=/home/abdulrahman/odoo/config/odoo15.conf
Traceback (most recent call last):
File "/home/abdulrahman/odoo/odoo-15.0/odoo-bin", line 5, in
import odoo
File "/home/abdulrahman/odoo/odoo-15.0/odoo/init.py", line 113, in
from . import modules
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/init.py", line 8, in
from . import db, graph, loading, migration, module, registry
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/graph.py", line 10, in
import odoo.tools as tools
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/init.py", line 8, in
from . import pdf
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/pdf.py", line 18, in
from odoo.tools.misc import file_open
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/misc.py", line 35, in
import babel
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/init.py", line 20, in
from babel.core import UnknownLocaleError, Locale, default_locale, \
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/core.py", line 14, in
from babel import localedata
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/localedata.py", line 17, in
from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/init.py)bdulrahman/odoo/config/odoo15.conf
Traceback (most recent call last):
File "/home/abdulrahman/odoo/odoo-15.0/odoo-bin", line 5, in
import odoo
File "/home/abdulrahman/odoo/odoo-15.0/odoo/init.py", line 113, in
from . import modules
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/init.py", line 8, in
from . import db, graph, loading, migration, module, registry
File "/home/abdulrahman/odoo/odoo-15.0/odoo/modules/graph.py", line 10, in
import odoo.tools as tools
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/init.py", line 8, in
from . import pdf
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/pdf.py", line 18, in
from odoo.tools.misc import file_open
File "/home/abdulrahman/odoo/odoo-15.0/odoo/tools/misc.py", line 35, in
import babel
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/init.py", line 20, in
from babel.core import UnknownLocaleError, Locale, default_locale, \
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/core.py", line 14, in
from babel import localedata
File "/home/abdulrahman/.local/lib/python3.10/site-packages/babel/localedata.py", line 17, in
from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/init.py))
This is the errors i want the solutions for it.
Hi I'm not sure if it's the proper solution but I experienced some difficulty with my python version and when I downgraded the version (to py3.9) it worked. You can Try it too. Also I suggest to check your launch.json configurations and make sure that all the paths and names have been set correctly.

Jupyter Notebook from command line - ImportError - cannot import name 'TYPE'

Traceback (most recent call last):
File "/Users/codymitchell/Documents/code/py/zipline/venv/bin/jupyter-notebook", line 6, in <module>
from notebook.notebookapp import main
File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/notebook/__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/notebook/nbextensions.py", line 610, in <module>
from .extensions import (
File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/notebook/extensions.py", line 8, in <module>
from tornado.log import LogFormatter
File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/tornado/log.py", line 34, in <module>
from tornado.escape import _unicode
File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/tornado/escape.py", line 27, in <module>
from tornado.util import unicode_type
File "/Users/codymitchell/Documents/code/py/zipline/venv/lib/python3.5/site-packages/tornado/util.py", line 21, in <module>
from typing import (
ImportError: cannot import name 'Type'
I had the same issue, here's how I solved it
Python 3.5.1 doesn't have typing.Type
https://github.com/django-extensions/django-extensions/issues/1188
C:\Users\rigupta>D:\Anaconda3\python
Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> typing.Type
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'typing' has no attribute 'Type'
>>> typing.type
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'typing' has no attribute 'type'
>>>
so I upgraded my python version to 3.5.4 by running below command which resolved the issue
conda update --all
https://www.youtube.com/watch?v=Q-dZCAk1tfc
I had the exact same problem. I am running windows 7 64-bit, running on Portable Python 3.7.3.
When Jupyter was failing, I was running Portable Python at this path:
E:\applications\python37\Portable Python-3.7.3\App\Python
Uninstalling and reinstalling Jupyter, typing modules did not solve the problem.
I was suspicions of problematic path-names, so I copied the python installation to a path without whitespaces (and maybe a shorter path?):
E:\applications\python37\Python
Finally, I managed to get Jupyter Notebook to work!

How to use the ibm_boto3 in python

Who has the same problem?
I want to store data in cos, but cannot use the ibm_boto3 on my machine.
To be sure to check with a sample, I used the code from the sample from this ibm-cos-sdk github.
Installed
pip3 freeze
backports.functools-lru-cache==1.5
botocore==1.12.28
docutils==0.14
futures==3.1.1
ibm-cos-sdk==2.3.2
ibm-cos-sdk-core==2.3.2
ibm-cos-sdk-s3transfer==2.3.2
-e git://github.com/boto/jmespath.git#1c9c35cf681b6605d8629e5ce8865221a4fd2a30#egg=jmespath
mock==1.3.0
nose==1.3.3
pbr==5.0.0
python-dateutil==2.7.3
s3transfer==0.1.13
six==1.11.0
urllib3==1.23
Here is my cli result and as you can see the ibm_boto3 is not found.
python3 test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
import ibm_boto3
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ibm_boto3/__init__.py", line 16, in <module>
from ibm_boto3.session import Session
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ibm_boto3/session.py", line 27, in <module>
import ibm_botocore.session
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ibm_botocore/session.py", line 37, in <module>
import ibm_botocore.credentials
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ibm_botocore/credentials.py", line 36, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Yeah, it looks like requests somehow fell out of the requirements file in the latest release. The team is patching it and will release an update soon.
In the meantime, you can manually install the package in your environment with pip3 install requests or by manually adding it to the requirements.txt file:
echo "requests==2.18.0" >> path/to/requirements.txt

Import Error of IBM Watson Natural Language Understanding API

I am now trying to extract keywords by using IBM Watson Natural Language Understanding API. I follow the instruction and have installed the watson_developer_cloud. However, I met an error when import the NaturalLanguageUnderstandingV1. Could you help me with it? Thank you!
from watson_developer_cloud import NaturalLanguageUnderstandingV1
Traceback (most recent call last):
File "<ipython-input-11-ab5aa6f014f4>", line 1, in <module>
from watson_developer_cloud import NaturalLanguageUnderstandingV1
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-
packages\watson_developer_cloud\__init__.py", line 30, in <module>
rom .speech_to_text_v1 import SpeechToTextV1
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-
packages\watson_developer_cloud\speech_to_text_v1.py", line 74, in <module>
from watson_developer_cloud.websocket import RecognizeCallback, RecognizeListener
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\watson_developer_cloud\websocket\__init__.py", line 18, in <module>
from .speech_to_text_websocket_listener import RecognizeListener
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\watson_developer_cloud\websocket\speech_to_text_websocket_listener.py", line 21, in <module>
from twisted.internet import ssl, reactor
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\twisted\internet\ssl.py", line 59, in <module>
from OpenSSL import SSL
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\crypto.py", line 16, in <module>
from OpenSSL._util import (
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: The operating system cannot run %1.
After reinstalling the watson-cloud-developer as an administrator. I solve the problem. It seems that if we do not run the pip install command as an administrator, then the package cannot be installed correctly.

how to fix import error in terminal, but in eclipse works fine

I got this estructure, that works in eclipse, but I got a import error in cmd. I tried sys.append.path but it does not works.
I´m running main.py
python main.py
In eclipse running the same code, ctrl+f11, it works fine.
Principal\__init__.py
Principal\lib\_init__.py
Principal\lib\functions.py
Principal\App_user\__init__.py
Principal\App_user\main.py
Principal\App_user\controller\__init__.py
Principal\App_user\controller\User_Controller.py
I got in User_Controller.py, from Principal.lib import funcionesDB it works in eclipse but it doesn't in cmd.
Traceback (most recent call last):
File "main.py", line 175, in <module>
main()
File "main.py", line 119, in main
from controlller.User_controller import User_Controller
File "C:\Users\NCB-APD\Desktop\Proyects\Apps\Aplicaciones\Principal\App_User\controller\User_Controller.py", line 21, in <module>
from Principal.lib import funcionesDB
ImportError: No module named Principal.lib
you may need to change you directory to where you code is, and then run it in cmd line like: python main.py, or you may need to specify the directory of your code just like: python "path of code"/print_test.py.