Why doesn't "pip install" work in Anaconda 3.7? - python

I installed Anaconda 3.7 on Windows 10.
When I try to run pip install xxx
I get the following message:
TypeError: 'module' object is not callable
Any advice on how to solve this will be much appreciated.

'module' object is not callable points to what xxx is as pointed out by #Lescurel.
You may be trying to access a class inside of the module (which wasn't added to their __init__) and need to change your import statement.
Try: import xxx.class
or
from xxx import class

Related

Why importing pydicom rise AttributeError: module 'gdcm' has no attribute 'DataElement'

After having installed libgdcm-tools (2.6.6-3) on my system (via apt install libgdcm-tools) I am not longer able to import pydicom in Python. When running import pydicom as pdc I got the following error
AttributeError: module 'gdcm' has no attribute 'DataElement'.
Removing libgdcm-tools does not solve the issue.
I am working with Python 3.7 and pydicom 2.0.0 in Ubuntu 18.04.
Indeed #scaramallion's comment pointed me in the right direction. I didnt't have a gcdm directory in the working directory, but in my home directory. Removing that directory solved the problem.

attribute errors: module has no attribute in tensorflow

I am trying to run a sample script where I use
import tensorflow as tf
def main():
if __name__ = '__main__':
tf.app.run(main = main)
that throws an error:
AttributeError: module 'tensorflow' has no attribute 'app'
but when i run it as:
from tensorflow.python.platform import app
it runs well.. the python version I am using is 3.6.1 and tensorflow version: 0.1.8
actuall even
print(tf.__version__)
is showing an attribute error..
AttributeError: module 'tensorflow' has no attribute '__version__'
As Mitiku pointed out.. there was a problem with the installation so i reinstalled it.. and it works now..
print( dir(tf)) -- this should show the list of packages under tensorflow..
My problem was running Tensorflow 1 script for version 2.
tf.app is moved to tf.compat.v1.app in version 2. There is a tool that helps to upgrade to version 2 automatically.
tf_upgrade_v2 --intree my_project/ --outtree my_project_v2/ --reportfile report.txt
I put it here in case somebody had same issue.

AttributeError: 'module' object has no attribute 'SubscriberClient'

After running sudo pip install google.cloud.pubsub
I am running the following python code in ubtunu google compute engine:
import google.cloud.pubsub_v1
I get the following error when importing this:
ImportError: No module named pubsub_v1 attribute 'SubscriberClient'
Can anyone tell me how to fix this?
Update your google-cloud-pubsub to the latest version. It should resolve the issue

AttributeError: 'module' object has no attribute 'connect'

I know that such error might appear if I named the file same as importing lib, but there are must be is something different, because the error persist even if try run that code below through the console:
# -*- coding: cp1251
import _mssql
connSQLserver = _mssql.connect(
server="localhost",
port=1433,
user="admin",
password="****",
database="master")
This is output:
AttributeError Traceback (most recent call last)
<ipython-input-18-8ecbd448023e> in <module>()
2 import _mssql
3
----> 4 connSQLserver = _mssql.connect(
5 server="localhost",
6 port=1433,
AttributeError: 'module' object has no attribute 'connect'
I'm trying to connect to locally installed sql server 2014, using pymssql-2.1.1-cp27-none-win_amd64.
I tried even import pymssql , nothing changed. According to official documentation, both library might be used. I use python 2.7.1 installed as a part of Anaconda, windows 7. Connection string might be wrong.
What may cause the error?
upd:
# -*- coding: cp1251
import _mssql
print _mssql
returns
<module '_mssql' (built-in)>
print _mssql.__file__ returns AttributeError: 'module' object has no attribute '__file__'
The issue is simply that .connect(...) must be capitalized like so .Connect(...).
When you install a python module as root, sometimes, the access rights to the modules files are limited for others than root.
Juste give recurse right as root to everyone:
by example for python 2.7 module, installed through pip2.7
chmod -R a+rx /usr/local/lib/python2.7
You can check this is a permission problem by launching program through strace...
I'm not sure what gave you the idea to import _pymssql; the leading underscore should have given you the clue that this is a private utility module. Just import pymssql.
Try _mssql.MSSQLConnection
from

Modules missing from installed package

I have installed and am trying to use fbconsole: https://github.com/facebook/fbconsole/
Looking at the instructions, I can make the first couple of steps work:
import fbconsole
fbconsole.AUTH_SCOPE = ['publish_stream', 'publish_checkins']
fbconsole.authenticate()
But when I try
fbconsole.logout()
I get
AttributeError: 'module' object has no attribute 'logout'
Looking at the file that's being installed, I do see both the authenticate() and the logout() module. Is the package not being installed correctly?
It's work correct for me!
Reinstall fbconsole with this command:
python setup.py install
I hope it's work for you too!
Good Luck
Is there same name with fbconsole.py or python package fbconsole in your python path?
If so then:
import fbconsole
print fbconsole.__file__
print dir(fbconsole) # look if the logout in the fcconsole module
then watch the file of the fbconsole module you import is what,
If not , you can atempte to remove the fbconsole.pyc in your python path(just use the same above code) and looks is it works.

Categories

Resources