HP ENVY 17" i7 laptop:
Kubuntu 21.10
Greetings, I'm relatively new to Opentelemetry. I've followed many tutorials including opentelemetry.io but I keep running into dependency problems with the python stack.
What is the expected behavior?
I don't expect any error
What is the actual behavior?
python ./metrics01.py ─╯
Traceback (most recent call last):
File "/home/iomari/temp/opentelemetry/newsample/./metrics01.py", line 7, in <module>
from opentelemetry.sdk.metrics.export.controller import PushController
ModuleNotFoundError: No module named 'opentelemetry.sdk.metrics.export.controller'
Additional context:
Using opentelemetry-python 1.12.0rc1:
─ pip freeze ─╯
asttokens==2.0.5
backcall==0.2.0
backoff==1.11.1
certifi==2022.6.15
chainmap==1.0.3
charset-normalizer==2.0.12
colorama==0.4.5
combomethod==1.0.12
decorator==5.1.1
Deprecated==1.2.13
executing==0.8.3
googleapis-common-protos==1.56.3b1
grpcio==1.47.0rc1
idna==3.3
ipython==8.4.0
jedi==0.18.1
matplotlib-inline==0.1.3
nulltype==2.3.1
opentelemetry-api==1.12.0rc1
opentelemetry-distro==0.31b0
opentelemetry-exporter-jaeger==1.12.0rc1
opentelemetry-exporter-jaeger-proto-grpc==1.12.0rc1
opentelemetry-exporter-jaeger-thrift==1.12.0rc1
opentelemetry-exporter-otlp==1.12.0rc1
opentelemetry-exporter-otlp-proto-grpc==1.12.0rc1
opentelemetry-exporter-otlp-proto-http==1.12.0rc1
opentelemetry-exporter-prometheus==1.12.0rc1
opentelemetry-instrumentation==0.31b0
opentelemetry-propagator-b3==1.12.0rc1
opentelemetry-propagator-jaeger==1.12.0rc1
opentelemetry-proto==1.12.0rc1
opentelemetry-sdk==1.12.0rc1
opentelemetry-semantic-conventions==0.31b0
options==1.4.10
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
prometheus-client==0.14.1
prompt-toolkit==3.0.29
protobuf==3.20.0
ptyprocess==0.7.0
pure-eval==0.2.2
Pygments==2.12.0
requests==2.28.0
six==1.12.0
stack-data==0.3.0
termcolor==1.1.0
thrift==0.16.0
traitlets==5.3.0
typing_extensions==4.2.0
urllib3==1.26.9
wcwidth==0.2.5
wrapt==1.14.1
Problem solved.
Did a pip cache purge, reinstalled all modules and all is working.
Related
I am currently on Windows 11 and facing this problem since upgrade. Each time I install anaconda-navigator, on first time opening it runs smoothly however on second time if I open from windows, it opens but gets stuck on environment loading and when I open it from prompt, I get the error below. I do realize that error is from conda-script.py line587 however I don't want to do modifications blindly so need some expert opinion on how to resolve it.
I never faced these issues even on last moment on Windows 10, and I don't know how much windows upgrade is a problem here.
(base) C:\Users\abdul>anaconda-navigator
2021-10-20 19:51:06,740 - ERROR anaconda_api._pip_data_ready:579
C:/Users/abdul/anaconda3/python.exe C:/Users/abdul/anaconda3/Scripts/conda-script.py list --json: Not a conda environment: C:/ProgramData/Anaconda3
Traceback (most recent call last):
File "C:\Users\abdul\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 587, in _pip_data_ready
channel_urls = set(package['base_url'] for package in output if package['platform'] != 'pypi')
File "C:\Users\abdul\anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 587, in <genexpr>
channel_urls = set(package['base_url'] for package in output if package['platform'] != 'pypi')
TypeError: string indices must be integers
I am trying to install tensor flow on my macOS M1.
As per chip compatibility I know that not all the pip images of tensor flow works or are even compatible. But I found this repository
https://github.com/apple/tensorflow_macos
Which is supposed to be working on Apple M1.
After the installation, I downgraded my python to version 3.8 and start the installation, everything went just fine without any issue.
just for testing purpose, I found this script online.
#!/usr/bin/env python
# coding: utf-8
# ## Sentiment Analysis on US Airline Reviews
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
from tensorflow.python.compiler.mlcompute import mlcompute
mlcompute.set_mlc_device(device_name='cpu')
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM,Dense, Dropout, SpatialDropout1D
from tensorflow.keras.layers import Embedding
df = pd.read_csv("./Tweets.csv")
# In[2]:
df.head()
# In[23]:
df.columns
# In[4]:
tweet_df = df[['text','airline_sentiment']]
print(tweet_df.shape)
tweet_df.head(5)
# In[22]:
tweet_df = tweet_df[tweet_df['airline_sentiment'] != 'neutral']
print(tweet_df.shape)
tweet_df.head(5)
# In[21]:
tweet_df["airline_sentiment"].value_counts()
# In[6]:
sentiment_label = tweet_df.airline_sentiment.factorize()
sentiment_label
# In[7]:
tweet = tweet_df.text.values
tokenizer = Tokenizer(num_words=5000)
tokenizer.fit_on_texts(tweet)
vocab_size = len(tokenizer.word_index) + 1
encoded_docs = tokenizer.texts_to_sequences(tweet)
padded_sequence = pad_sequences(encoded_docs, maxlen=200)
# In[8]:
print(tokenizer.word_index)
# In[9]:
print(tweet[0])
print(encoded_docs[0])
# In[10]:
print(padded_sequence[0])
# In[11]:
embedding_vector_length = 32
model = Sequential()
model.add(Embedding(vocab_size, embedding_vector_length, input_length=200) )
model.add(SpatialDropout1D(0.25))
model.add(LSTM(50, dropout=0.5, recurrent_dropout=0.5))
model.add(Dropout(0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy',optimizer='adam', metrics=['accuracy'])
print(model.summary())
# In[12]:
history = model.fit(padded_sequence,sentiment_label[0],validation_split=0.2, epochs=5, batch_size=32)
# In[16]:
plt.plot(history.history['accuracy'], label='acc')
plt.plot(history.history['val_accuracy'], label='val_acc')
plt.legend()
plt.show()
plt.savefig("Accuracy plot.jpg")
# In[25]:
plt.plot(history.history['loss'], label='loss')
plt.plot(history.history['val_loss'], label='val_loss')
plt.legend()
plt.show()
plt.savefig("Loss plot.jpg")
# In[18]:
def predict_sentiment(text):
tw = tokenizer.texts_to_sequences([text])
tw = pad_sequences(tw,maxlen=200)
prediction = int(model.predict(tw).round().item())
print("Predicted label: ", sentiment_label[1][prediction])
# In[19]:
test_sentence1 = "I enjoyed my journey on this flight."
predict_sentiment(test_sentence1)
test_sentence2 = "This is the worst flight experience of my life!"
predict_sentiment(test_sentence2)
But when I run it,
I get this error
Traceback (most recent call last):
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Sentiment Analysis.py", line 13, in <module>
from tensorflow.python.compiler.mlcompute import mlcompute
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
The error is about the architecture but I have no idea how to fix. Did anyone found a solution to this problem?
Thank you so much for any help you can provide.
Things should work better now.
As of Oct. 25, 2021 macOS 12 Monterey is generally available.
Upgrade your machine to Monterey or newer OS if you haven't already.
If you have conda installed, I would probably uninstall it. You can have multiple conda versions installed but things can get tricky.
Then follow the instructions from Apple here. I cleaned them up a bit below:
Download and install Conda from Miniforge:
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
In an active conda environment, install the TensorFlow dependencies, base TensorFlow, and TensorFlow metal:
conda install -c apple tensorflow-deps
pip install tensorflow-macos
pip install tensorflow-metal
You should be good to go with fast training speeds.
I just worked through this Upgrade guide for the Hortonworks Data Platform:
https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.0.0/bk_ambari-upgrade/bk_ambari-upgrade.pdf
I did all the steps as described in section 1 - 4 (Ambari upgrade). But now I have the problem, that my services won't start anymore!
Ambari can find all hosts, but they won't start!
E.g. for the HDFS starting I got the following error message:
2017-11-13 19:41:11,427 - Unable to load available packages
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 771, in load_available_packages
self.available_packages_in_repos = pkg_provider.get_available_packages_in_repos(repos)
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 85, in get_available_packages_in_repos
available_packages.extend(self._get_available_packages(repo))
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 146, in _get_available_packages
return self._lookup_packages(cmd, 'Available Packages')
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 191, in _lookup_packages
if items[i + 2].find('#') == 0:
IndexError: list index out of range
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py", line 73, in <module>
HdfsClient().execute()
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 367, in execute
method(env)
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 930, in restart
self.install(env)
File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py", line 35, in install
import params
File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/params.py", line 25, in <module>
from params_linux import *
File "/var/lib/ambari-agent/cache/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py", line 391, in <module>
lzo_packages = get_lzo_packages(stack_version_unformatted)
File "/usr/lib/python2.6/site-packages/resource_management/libraries/functions/get_lzo_packages.py", line 45, in get_lzo_packages
lzo_packages += [script_instance.format_package_name("hadooplzo_${stack_version}"),
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 538, in format_package_name
raise Fail("Cannot match package for regexp name {0}. Available packages: {1}".format(name, self.available_packages_in_repos))
resource_management.core.exceptions.Fail: Cannot match package for regexp name hadooplzo_${stack_version}. Available packages: []
(I think the most important part is the message resource_management.core.exceptions.Fail: Cannot match package for regexp name hadooplzo_${stack_version}. Available packages: [] which looks like there would be no version (package) available...!
I just saw, that I upgraded also the Ambari Metrics Monitor, Ambari Metrics Hadoop Sink and the Metrics Collector before starting the Services once (the manual is a little bit confusing here, see step 4.3.3)! Was this a mistake?
I tried to upgrade from Ambari 2.4 to Ambari 2.6 (HDP 2.5 installed)! Operating system is CentOS 7.
However, I need to reset / downgrade the Ambari or upgrade the Services to be able to start them again! Can someone help? Any help would be appreciated! Thank you!
Finally I was able to downgrade my Ambari installation back to version 2.4.2 as it was before starting the upgrade process.
To make a downgrade you have to do the following steps on the appropriate nodes:
# delete the new ambari repo file
rm /etc/yum.repos.d/ambari.repo
# download the old ambari repo file (for me version 2.4.2), as described in ambari installation guide (here for Centos 7)
wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
yum clean all
yum repolist
# check for the correct version (e.g. 2.4.2) of the Ambari repo
# Downgrade all components to this version
yum downgrade ambari-metrics-monitor
yum downgrade ambari-metrics-hadoop-sink
yum downgrade ambari-agent
...
Afterwards I upgraded again, but to Ambari version 2.5.2.0, which now worked without a problem. I also was able to upgrade my HDP installation to version 2.6.3.0 via this Ambari version.
I will skip Ambari 2.6.0 and will try to upgrade Ambari with a later future release.
I have been working on a web scraping program and it has recently just stopped working and is giving me the following error.
Traceback (most recent call last):
File "C:/Users/Bob/Desktop/test 3.5.py", line 7, in <module>
with open(saveDB,'rb') as f:
TypeError: invalid file: WindowsPath('Z:/project1/MasterWellDB.txt')
Where Z: is a network drive, but I have also moved the file locally and the error still exists.
I have tried multiple python versions, uninstalled and reinstalled visual studio multiple times and I am still clueless.
Here is my code:
from pathlib import Path
import pickle
# Opening well database
saveDB = Path(r"Z:\project1\MasterWellDB.txt")
#open picked DB if avaiable else remake database
if saveDB.exists():
with open(saveDB,'rb') as f:
wells = pickle.load(f)
print('success!')
Any help would be greatly appreciated. Thanks!
I am trying to get Django with MySQL working on my Windows 7 machine.
I need mySQLDB interface for this. When I try to install "mySQLDB interface", it looks for the MySQL installation in HKEY_LOCAL_MACHINE.
But in my registry it shows up in HKEY_CURRENT_USER/SOFTWARE/MySQL AB/MySQL Server 5.5.
My SQL instance seems to work fine.
MySQLDB installer somehow needs this in HKEY_LOCAL_MACHINE (I think) as it doesn't let me finish the install. It throws me this error.
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "C:\Blah\Software\MySQL-python-1.2.3\setup_windows.
py", line 8, in get_config
mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location')
WindowsError: [Error 2] The system cannot find the file specified
Thanks a lot for your time.
You can fix the registry key in site.cfg. Or you can download a Windows MSI package from SourceForge. (No, it did not exist when the question was posted.)