cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python Agent in python 3.6

antonio.carrasco
Explorer

Hi,

 

I can't install the python agent in python 3.6, the appdynamics dependencies are not installed with pip.

I tried installing manually but it doesn't work and with python 3.4 but is not working also.

 

I have a virtualenv with python3.6

Whe I run pyagent run -c /etc/appdynamics.cfg -- gunicorn app.wsgi:application -w 2 --reload --log-level=debug --timeout 150

it gives me: 

NameError: name 'appdynamics' is not defined

3 REPLIES 3

Ayush.Ghosh
AppDynamics Team

Hi, 

 

Could you do a ls -lf in the agent installed directory and send us the output, I belive it will be in your <virtual environment>/lib/pythonX.x/site-packages/.

There is a open issue with Python 3.4+, I just want to make sure its not the case.

 

It couldn't find appdynamics, and you also iterated that you are unable to install. What error are you getting while installing.

 

Is it possible to run you application in Python 2.7 ?

 

 

Thanks

Ayush

antonio.carrasco
Explorer

This is the error when starting the pyagent:

 

(venv) [ec2-user@ip site-packages]$ pyagent run -c /etc/appdynamics.cfg - gunicorn my_app.wsgi -b unix:///var/app/run/gunicorn.sock -w 5
2017-05-12 02:58:19,704 [WARNING] appdynamics.proxy.watchdog <3161>: Defunct proxy pid (3476) found; starting over
2017-05-12 02:58:19,706 [INFO] appdynamics.proxy.watchdog <3161>: Started watchdog with pid=3161
Traceback (most recent call last):
  File "/var/app/envs/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 429, in get_provider
    module = sys.modules[moduleOrReq]
KeyError: 'appdynamics_bindeps.proxy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/app/envs/venv/bin/pyagent", line 11, in <module>
    sys.exit(main())
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/scripts/pyagent/pyagent.py", line 65, in main
    mod.command(options, args)
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/scripts/pyagent/commands/run.py", line 159, in command
    proxy.start(proxy_args)
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/scripts/pyagent/commands/proxy.py", line 119, in start
    proxy_pid = start_fn(run_proxy_script=run_proxy_script, script_args=args, debug=debug)
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/scripts/pyagent/commands/proxy.py", line 221, in start_watchdog
    start_proxy(run_proxy_script=run_proxy_script, script_args=script_args, debug=debug, proxy_logger=logger)
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/scripts/pyagent/commands/proxy.py", line 227, in start_proxy
    run_proxy_script = run_proxy_script or resource_filename('appdynamics_bindeps.proxy', 'runProxy')
  File "/var/app/envs/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1197, in resource_filename
    return get_provider(package_or_requirement).get_resource_filename(
  File "/var/app/envs/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 431, in get_provider
    __import__(moduleOrReq)
ModuleNotFoundError: No module named 'appdynamics_bindeps'
2017-05-12 02:58:19,884 [ERROR] appdynamics.agent <3159>: Exception in agent startup.
Traceback (most recent call last):
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/agent/__init__.py", line 133, in import_zmq
    __import__('appdynamics_bindeps.zmq')
ModuleNotFoundError: No module named 'appdynamics_bindeps'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/autoinject/sitecustomize.py", line 20, in <module>
    import appdynamics.agent
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/agent/__init__.py", line 138, in <module>
    import_zmq()
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/agent/__init__.py", line 135, in import_zmq
    make_virtual_bindeps_package()
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/agent/__init__.py", line 50, in make_virtual_bindeps_package
    src_root = get_bindeps_location()
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/agent/__init__.py", line 96, in get_bindeps_location
    import appdynamics_bindeps
ModuleNotFoundError: No module named 'appdynamics_bindeps'
Failed to import the site module
Traceback (most recent call last):
  File "/var/app/envs/venv/lib/python3.6/site.py", line 703, in <module>
    main()
  File "/var/app/envs/venv/lib/python3.6/site.py", line 694, in main
    execsitecustomize()
  File "/var/app/envs/venv/lib/python3.6/site.py", line 548, in execsitecustomize
    import sitecustomize
  File "/var/app/envs/venv/lib/python3.6/site-packages/appdynamics/autoinject/sitecustomize.py", line 27, in <module>
    appdynamics.agent.remove_autoinject()
NameError: name 'appdynamics' is not defined

 

This is the output after running pip install appdynamics:

 

Collecting appdynamics
  Downloading appdynamics-4.3.1.0-py2.py3-none-any.whl (218kB)
    100% |████████████████████████████████| 225kB 3.4MB/s 
Installing collected packages: appdynamics
Successfully installed appdynamics-4.3.1.0

Notice the dependencies  appdynamics-proxysupport-linux-x64 and appdynamics-bindeps-linux-x64 are not installed. An ls -lf | grep appdynamics shows:

 

appdynamics
appdynamics-4.3.1.0.dist-info

 

Thank you! 

Hi,

 

Sorry you had to face the issue. Its a known issue, and we have resolved it, and the fix will out in next release.

 

In the mean while, I would request you to try installing the dependencies, directly using.

 

pip install appdynamics-bindeps-linux-x64 appdynamics-proxysupport-linux-x64

 

Or is possible use lower version python than 3.4.

 

Thanks

Ayush